-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
undefined classes
- Loading branch information
Showing
30 changed files
with
511 additions
and
53 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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 @@ | ||
export default { | ||
html: `<div class="false"></div>`, | ||
}; |
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 @@ | ||
<div class={false}></div> |
42 changes: 42 additions & 0 deletions
42
test/runtime/samples/attribute-null-classname-no-style/_config.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,42 @@ | ||
export default { | ||
props: { | ||
testName: "testClassName" | ||
}, | ||
|
||
html: `<div class="testClassName"></div>`, | ||
|
||
test({ assert, component, target }) { | ||
const div = target.querySelector('div'); | ||
assert.equal(div.className, 'testClassName'); | ||
|
||
component.testName = null; | ||
assert.equal(div.className, ''); | ||
|
||
component.testName = undefined; | ||
assert.equal(div.className, ''); | ||
|
||
component.testName = undefined + ''; | ||
assert.equal(div.className, 'undefined'); | ||
|
||
component.testName = null + ''; | ||
assert.equal(div.className, 'null'); | ||
|
||
component.testName = 1; | ||
assert.equal(div.className, '1'); | ||
|
||
component.testName = 0; | ||
assert.equal(div.className, '0'); | ||
|
||
component.testName = false; | ||
assert.equal(div.className, 'false'); | ||
|
||
component.testName = true; | ||
assert.equal(div.className, 'true'); | ||
|
||
component.testName = {}; | ||
assert.equal(div.className, '[object Object]'); | ||
|
||
component.testName = ''; | ||
assert.equal(div.className, ''); | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
test/runtime/samples/attribute-null-classname-no-style/main.svelte
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 @@ | ||
<script> | ||
export let testName; | ||
</script> | ||
|
||
<div class={testName}></div> |
40 changes: 40 additions & 0 deletions
40
test/runtime/samples/attribute-null-classname-with-style/_config.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,40 @@ | ||
export default { | ||
html: `<div class=" svelte-x1o6ra"></div>`, | ||
|
||
test({ assert, component, target }) { | ||
const div = target.querySelector('div'); | ||
|
||
component.testName = null; | ||
assert.equal(div.className, ' svelte-x1o6ra'); | ||
|
||
component.testName = undefined; | ||
assert.equal(div.className, ' svelte-x1o6ra'); | ||
|
||
component.testName = undefined + ''; | ||
assert.equal(div.className, 'undefined svelte-x1o6ra'); | ||
|
||
component.testName = null + ''; | ||
assert.equal(div.className, 'null svelte-x1o6ra'); | ||
|
||
component.testName = 1; | ||
assert.equal(div.className, '1 svelte-x1o6ra'); | ||
|
||
component.testName = 0; | ||
assert.equal(div.className, '0 svelte-x1o6ra'); | ||
|
||
component.testName = false; | ||
assert.equal(div.className, 'false svelte-x1o6ra'); | ||
|
||
component.testName = true; | ||
assert.equal(div.className, 'true svelte-x1o6ra'); | ||
|
||
component.testName = {}; | ||
assert.equal(div.className, '[object Object] svelte-x1o6ra'); | ||
|
||
component.testName = ''; | ||
assert.equal(div.className, ' svelte-x1o6ra'); | ||
|
||
component.testName = 'testClassName'; | ||
assert.equal(div.className, 'testClassName svelte-x1o6ra'); | ||
} | ||
}; |
11 changes: 11 additions & 0 deletions
11
test/runtime/samples/attribute-null-classname-with-style/main.svelte
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,11 @@ | ||
<script> | ||
export let testName; | ||
</script> | ||
|
||
<style> | ||
div { | ||
color: purple; | ||
} | ||
</style> | ||
|
||
<div class={testName}></div> |
45 changes: 45 additions & 0 deletions
45
test/runtime/samples/attribute-null-classnames-no-style/_config.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,45 @@ | ||
export default { | ||
props: { | ||
testName1: "test1", | ||
testName2: "test2", | ||
}, | ||
|
||
html: `<div class="test1test2"></div>`, | ||
|
||
test({ assert, component, target }) { | ||
const div = target.querySelector('div'); | ||
assert.equal(div.className, 'test1test2'); | ||
|
||
component.testName1 = null; | ||
component.testName2 = null; | ||
assert.equal(div.className, '0'); | ||
|
||
component.testName1 = null; | ||
component.testName2 = "test"; | ||
assert.equal(div.className, 'nulltest'); | ||
|
||
component.testName1 = undefined; | ||
component.testName2 = "test"; | ||
assert.equal(div.className, 'undefinedtest'); | ||
|
||
component.testName1 = undefined; | ||
component.testName2 = undefined; | ||
assert.equal(div.className, 'NaN'); | ||
|
||
component.testName1 = null; | ||
component.testName2 = 1; | ||
assert.equal(div.className, '1'); | ||
|
||
component.testName1 = undefined; | ||
component.testName2 = 1; | ||
assert.equal(div.className, 'NaN'); | ||
|
||
component.testName1 = null; | ||
component.testName2 = 0; | ||
assert.equal(div.className, '0'); | ||
|
||
component.testName1 = undefined; | ||
component.testName2 = 0; | ||
assert.equal(div.className, 'NaN'); | ||
} | ||
}; |
6 changes: 6 additions & 0 deletions
6
test/runtime/samples/attribute-null-classnames-no-style/main.svelte
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 @@ | ||
<script> | ||
export let testName1; | ||
export let testName2; | ||
</script> | ||
|
||
<div class={testName1 + testName2}></div> |
Oops, something went wrong.