style-directive: tests

pull/5923/head
pmurray73 6 years ago committed by Tan Li Hau
parent 52a7473e40
commit 8f4faf450e

@ -0,0 +1,41 @@
{
"html": {
"start": 0,
"end": 29,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 29,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 22,
"type": "Class",
"name": "foo",
"modifiers": [],
"expression": {
"type": "Identifier",
"start": 16,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 21
}
},
"name": "isFoo"
}
}
],
"children": []
}
]
}
}

@ -0,0 +1 @@
<div style="color: red;">red</div>

@ -0,0 +1,41 @@
{
"html": {
"start": 0,
"end": 34,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 34,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 24,
"type": "Attribute",
"name": "style",
"value": [
{
"start": 12,
"end": 23,
"type": "Text",
"raw": "color: red;",
"data": "color: red;"
}
]
}
],
"children": [
{
"start": 25,
"end": 28,
"type": "Text",
"raw": "red",
"data": "red"
}
]
}
]
}
}

@ -0,0 +1,5 @@
<script>
export let color = 'red';
</script>
<p style="height: 40px;" style:color={color}>{color}</p>

@ -1,5 +1,5 @@
<script>
export let myColor = 'red';
export let myColor = "red";
</script>
<p style:color={myColor} />
<p style:color={myColor} />

@ -0,0 +1,12 @@
export default {
html: `
<div style="color: red;"></div>
`,
test({ assert, component, target, window }) {
const p = target.querySelector('div');
const styles = window.getComputedStyle(p);
assert.equal(styles.color, 'red');
}
};

@ -0,0 +1 @@
<div style="color: red;"></div>
Loading…
Cancel
Save