1
+ import { join } from "path" ;
1
2
import { partial } from "lodash" ;
2
- import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types" ;
3
- import { generateModel } from "@ui5-language-assistant/test-utils" ;
4
- import { generate } from "@ui5-language-assistant/semantic-model" ;
5
3
import {
6
4
validations ,
7
5
buildMessage ,
@@ -12,9 +10,17 @@ import {
12
10
assertSingleIssue as assertSingleIssueBase ,
13
11
testValidationsScenario ,
14
12
computeExpectedRanges ,
15
- getDefaultContext ,
16
13
} from "../../test-utils" ;
17
- import { Context as AppContext } from "@ui5-language-assistant/context" ;
14
+ import {
15
+ Context as AppContext ,
16
+ getContext ,
17
+ } from "@ui5-language-assistant/context" ;
18
+ import {
19
+ Config ,
20
+ ProjectName ,
21
+ ProjectType ,
22
+ TestFramework ,
23
+ } from "@ui5-language-assistant/test-framework" ;
18
24
19
25
const {
20
26
UNKNOWN_CLASS_IN_NS ,
@@ -28,15 +34,29 @@ const {
28
34
} = validations ;
29
35
30
36
describe ( "the unknown tag name validation" , ( ) => {
31
- let ui5SemanticModel : UI5SemanticModel ;
32
37
let appContext : AppContext ;
38
+ let framework : TestFramework ;
39
+ const viewFilePathSegments = [
40
+ "app" ,
41
+ "manage_travels" ,
42
+ "webapp" ,
43
+ "ext" ,
44
+ "main" ,
45
+ "Main.view.xml" ,
46
+ ] ;
33
47
beforeAll ( async ( ) => {
34
- ui5SemanticModel = await generateModel ( {
35
- framework : "SAPUI5" ,
36
- version : "1.71.49" ,
37
- modelGenerator : generate ,
38
- } ) ;
39
- appContext = getDefaultContext ( ui5SemanticModel ) ;
48
+ const config : Config = {
49
+ projectInfo : {
50
+ name : ProjectName . cap ,
51
+ type : ProjectType . CAP ,
52
+ npmInstall : false ,
53
+ deleteBeforeCopy : false ,
54
+ } ,
55
+ } ;
56
+ framework = new TestFramework ( config ) ;
57
+ appContext = ( await getContext (
58
+ join ( framework . getProjectRoot ( ) , ...viewFilePathSegments )
59
+ ) ) as AppContext ;
40
60
} ) ;
41
61
42
62
describe ( "true positive scenarios" , ( ) => {
@@ -563,6 +583,18 @@ describe("the unknown tag name validation", () => {
563
583
) ;
564
584
} ) ;
565
585
586
+ it ( "will not detect an issue for typedefs as element [macrosTable:Action]" , async ( ) => {
587
+ assertNoIssues (
588
+ `<mvc:View
589
+ xmlns:macrosTable="sap.fe.macros.table"
590
+ >
591
+ <macrosTable:Action
592
+ key="customAction"
593
+ text="My Custom Action"
594
+ />
595
+ </mvc:View>`
596
+ ) ;
597
+ } ) ;
566
598
it ( "will detect an issue for sap.ui.core.ExtensionPoint in the root tag" , ( ) => {
567
599
assertSingleIssue (
568
600
`<🢂ExtensionPoint🢀 name="extension1"></ExtensionPoint>` ,
0 commit comments