-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...tion-karma/test-hydration/mismatches/style-attr/computed/different-priority/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export default { | ||
props: { | ||
dynamicStyle: 'background-color: red; border-color: red;', | ||
}, | ||
clientProps: { | ||
dynamicStyle: 'background-color: red; border-color: red !important;', | ||
}, | ||
snapshot(target) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
return { | ||
p, | ||
style: p.getAttribute('style'), | ||
}; | ||
}, | ||
test(target, snapshots, consoleCalls) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
|
||
expect(p).not.toBe(snapshots.p); | ||
expect(p.getAttribute('style')).not.toBe(snapshots.style); | ||
expect(p.getAttribute('style')).toBe( | ||
'background-color: red; border-color: red !important;' | ||
); | ||
|
||
expect(consoleCalls.error).toHaveSize(2); | ||
expect(consoleCalls.error[0][0].message).toContain( | ||
'[LWC error]: Mismatch hydrating element <p>: attribute "style" has different values, expected "background-color: red; border-color: red !important;" but found "background-color: red; border-color: red;"' | ||
); | ||
expect(consoleCalls.error[1][0].message).toContain('Hydration completed with errors.'); | ||
}, | ||
}; |
3 changes: 3 additions & 0 deletions
3
...n-karma/test-hydration/mismatches/style-attr/computed/different-priority/x/main/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<p style={dynamicStyle}>txt</p> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...ion-karma/test-hydration/mismatches/style-attr/computed/different-priority/x/main/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Main extends LightningElement { | ||
@api dynamicStyle; | ||
} |
30 changes: 30 additions & 0 deletions
30
...ation-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export default { | ||
props: { | ||
dynamicStyle: 'background-color: red; border-color: red;', | ||
}, | ||
clientProps: { | ||
dynamicStyle: 'background-color: red; border-color: red; margin: 1px;', | ||
}, | ||
snapshot(target) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
return { | ||
p, | ||
style: p.getAttribute('style'), | ||
}; | ||
}, | ||
test(target, snapshots, consoleCalls) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
|
||
expect(p).not.toBe(snapshots.p); | ||
expect(p.getAttribute('style')).not.toBe(snapshots.style); | ||
expect(p.getAttribute('style')).toBe( | ||
'background-color: red; border-color: red; margin: 1px;' | ||
); | ||
|
||
expect(consoleCalls.error).toHaveSize(2); | ||
expect(consoleCalls.error[0][0].message).toContain( | ||
'Mismatch hydrating element <p>: attribute "style" has different values, expected "background-color: red; border-color: red; margin: 1px;" but found "background-color: red; border-color: red;"' | ||
); | ||
expect(consoleCalls.error[1][0].message).toContain('Hydration completed with errors.'); | ||
}, | ||
}; |
3 changes: 3 additions & 0 deletions
3
...on-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/x/main/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<p style={dynamicStyle}>txt</p> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...tion-karma/test-hydration/mismatches/style-attr/computed/extra-from-client/x/main/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Main extends LightningElement { | ||
@api dynamicStyle; | ||
} |
28 changes: 28 additions & 0 deletions
28
...ation-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export default { | ||
props: { | ||
dynamicStyle: 'background-color: red; border-color: red; margin: 1px;', | ||
}, | ||
clientProps: { | ||
dynamicStyle: 'background-color: red; border-color: red;', | ||
}, | ||
snapshot(target) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
return { | ||
p, | ||
style: p.getAttribute('style'), | ||
}; | ||
}, | ||
test(target, snapshots, consoleCalls) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
|
||
expect(p).not.toBe(snapshots.p); | ||
expect(p.getAttribute('style')).not.toBe(snapshots.style); | ||
expect(p.getAttribute('style')).toBe('background-color: red; border-color: red;'); | ||
|
||
expect(consoleCalls.error).toHaveSize(2); | ||
expect(consoleCalls.error[0][0].message).toContain( | ||
'[LWC error]: Mismatch hydrating element <p>: attribute "style" has different values, expected "background-color: red; border-color: red;" but found "background-color: red; border-color: red; margin: 1px;"' | ||
); | ||
expect(consoleCalls.error[1][0].message).toContain('Hydration completed with errors.'); | ||
}, | ||
}; |
3 changes: 3 additions & 0 deletions
3
...on-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/x/main/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<p style={dynamicStyle}>txt</p> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...tion-karma/test-hydration/mismatches/style-attr/computed/extra-from-server/x/main/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Main extends LightningElement { | ||
@api dynamicStyle; | ||
} |
29 changes: 29 additions & 0 deletions
29
...on-karma/test-hydration/mismatches/style-attr/computed/same-different-order/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export default { | ||
props: { | ||
dynamicStyle: 'background-color: red; border-color: red; margin: 1px;', | ||
}, | ||
clientProps: { | ||
dynamicStyle: 'margin: 1px; border-color: red; background-color: red;', | ||
}, | ||
snapshot(target) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
return { | ||
p, | ||
style: p.getAttribute('style'), | ||
}; | ||
}, | ||
test(target, snapshots, consoleCalls) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
|
||
expect(p).not.toBe(snapshots.p); | ||
expect(p.getAttribute('style')).toBe( | ||
'margin: 1px; border-color: red; background-color: red;' | ||
); | ||
|
||
expect(consoleCalls.error).toHaveSize(2); | ||
expect(consoleCalls.error[0][0].message).toContain( | ||
'Mismatch hydrating element <p>: attribute "style" has different values, expected "margin: 1px; border-color: red; background-color: red;" but found "background-color: red; border-color: red; margin: 1px;"' | ||
); | ||
expect(consoleCalls.error[1][0].message).toContain('Hydration completed with errors.'); | ||
}, | ||
}; |
3 changes: 3 additions & 0 deletions
3
...karma/test-hydration/mismatches/style-attr/computed/same-different-order/x/main/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<p style={dynamicStyle}>txt</p> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...n-karma/test-hydration/mismatches/style-attr/computed/same-different-order/x/main/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Main extends LightningElement { | ||
@api dynamicStyle; | ||
} |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...ration-karma/test-hydration/mismatches/style-attr/computed/same-priority/x/main/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<p style={dynamicStyle}>txt</p> | ||
</template> |
6 changes: 6 additions & 0 deletions
6
...egration-karma/test-hydration/mismatches/style-attr/computed/same-priority/x/main/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Main extends LightningElement { | ||
// Note: extra spaces matters | ||
dynamicStyle = 'background-color: red; border-color: red !important ; '; | ||
} |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/x/main/main.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<p style={dynamicStyle}>txt</p> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
.../@lwc/integration-karma/test-hydration/mismatches/style-attr/computed/same/x/main/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement, api } from 'lwc'; | ||
|
||
export default class Main extends LightningElement { | ||
@api dynamicStyle = 'background-color: red; border-color: red; margin: 1px;'; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...karma/test-hydration/mismatches/style-attr/static/unoptimized-same-priority/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default { | ||
snapshot(target) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
return { | ||
p, | ||
style: p.getAttribute('style'), | ||
}; | ||
}, | ||
test(target, snapshots) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
|
||
expect(p).toBe(snapshots.p); | ||
expect(p.getAttribute('style')).toBe(snapshots.style); | ||
}, | ||
}; |
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions
17
...egration-karma/test-hydration/mismatches/style-attr/static/unoptimized-same/index.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export default { | ||
snapshot(target) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
return { | ||
p, | ||
style: p.getAttribute('style'), | ||
}; | ||
}, | ||
test(target, snapshots, consoleCalls) { | ||
const p = target.shadowRoot.querySelector('p'); | ||
|
||
expect(p).toBe(snapshots.p); | ||
expect(p.getAttribute('style')).toBe(snapshots.style); | ||
|
||
expect(consoleCalls.error).toHaveSize(0); | ||
}, | ||
}; |
File renamed without changes.
File renamed without changes.