@@ -54,18 +54,18 @@ export class TemplateAnalysisTests {
54
54
} ) ;
55
55
}
56
56
57
- @test 'properties of the same value that have been redefined in-ruleset do not throw an error ' ( ) {
57
+ @test 'all properties of the same type must match, in order, for a conflict to not be thrown ' ( ) {
58
58
let imports = new MockImportRegistry ( ) ;
59
59
let options : PluginOptions = { importer : imports . importer ( ) } ;
60
60
let reader = new OptionsReader ( options ) ;
61
61
62
62
imports . registerSource ( "blocks/b.block.css" ,
63
- `.root { block-name: block-b; color: red; color: blue; background : yellow; }`
63
+ `.root { block-name: block-b; color: blue; color : yellow; }`
64
64
) ;
65
65
66
66
let css = `
67
67
@block-reference b from "./b.block.css";
68
- .root { block-name: block-a; color: blue; background- color: yellow; }
68
+ .root { block-name: block-a; color: blue; color: yellow; }
69
69
` ;
70
70
71
71
return this . parseBlock ( css , "blocks/foo.block.css" , reader ) . then ( ( [ block , _ ] ) => {
@@ -74,7 +74,39 @@ export class TemplateAnalysisTests {
74
74
} ) ;
75
75
}
76
76
77
- @test 'properties of the different values that have been redefined in-ruleset throw an error' ( ) {
77
+ @test 'if properties of the same type do not match, in order, a conflict is thrown' ( ) {
78
+ let imports = new MockImportRegistry ( ) ;
79
+ let options : PluginOptions = { importer : imports . importer ( ) } ;
80
+ let reader = new OptionsReader ( options ) ;
81
+
82
+ imports . registerSource ( "blocks/b.block.css" ,
83
+ `.root { block-name: block-b; color: red; color: yellow; }`
84
+ ) ;
85
+
86
+ let css = `
87
+ @block-reference b from "./b.block.css";
88
+ .root { block-name: block-a; color: blue; color: yellow; }
89
+ ` ;
90
+
91
+ return assertParseError (
92
+ cssBlocks . TemplateAnalysisError ,
93
+
94
+ `The following property conflicts must be resolved for these co-located Styles: (templates/my-template.hbs:10:32)
95
+
96
+ color:
97
+ block-a.root (blocks/foo.block.css:3:36)
98
+ block-a.root (blocks/foo.block.css:3:49)
99
+ block-b.root (blocks/b.block.css:1:30)
100
+ block-b.root (blocks/b.block.css:1:42)` ,
101
+
102
+ this . parseBlock ( css , "blocks/foo.block.css" , reader ) . then ( ( [ block , _ ] ) => {
103
+ constructElement ( block , '.root' , 'b.root' ) . end ( ) ;
104
+ assert . deepEqual ( 1 , 1 ) ;
105
+ } )
106
+ ) ;
107
+ }
108
+
109
+ @test 'properties with different values that have been redefined in-ruleset throw an error' ( ) {
78
110
let imports = new MockImportRegistry ( ) ;
79
111
let options : PluginOptions = { importer : imports . importer ( ) } ;
80
112
let reader = new OptionsReader ( options ) ;
@@ -95,6 +127,7 @@ export class TemplateAnalysisTests {
95
127
96
128
color:
97
129
block-a.root (blocks/foo.block.css:3:36)
130
+ block-b.root (blocks/b.block.css:1:30)
98
131
block-b.root (blocks/b.block.css:1:43)` ,
99
132
100
133
this . parseBlock ( css , "blocks/foo.block.css" , reader ) . then ( ( [ block , _ ] ) => {
0 commit comments