mirror of https://github.com/sveltejs/svelte
Failing test for #1284 Fixes #1284pull/1285/head
parent
b506e5a596
commit
e81fb88f41
@ -0,0 +1,11 @@
|
|||||||
|
import { Node } from '../interfaces';
|
||||||
|
|
||||||
|
export default function nodeToString(prop: Node) {
|
||||||
|
if (prop.value.type === 'Literal' && typeof prop.value.value === 'string') {
|
||||||
|
return prop.value.value;
|
||||||
|
} else if (prop.value.type === 'TemplateLiteral'
|
||||||
|
&& prop.value.quasis.length === 1
|
||||||
|
&& prop.value.expressions.length === 0) {
|
||||||
|
return prop.value.quasis[0].value.raw;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<rect x='{{x}}' y='{{y}}' width='{{width}}' height='{{height}}'/>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
namespace: `svg`
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1,21 @@
|
|||||||
|
export default {
|
||||||
|
data: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
width: 100,
|
||||||
|
height: 100
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `<svg><rect x="0" y="0" width="100" height="100"></rect></svg>`,
|
||||||
|
|
||||||
|
test ( assert, component, target ) {
|
||||||
|
const svg = target.querySelector( 'svg' );
|
||||||
|
const rect = target.querySelector( 'rect' );
|
||||||
|
|
||||||
|
assert.equal( svg.namespaceURI, 'http://www.w3.org/2000/svg' );
|
||||||
|
assert.equal( rect.namespaceURI, 'http://www.w3.org/2000/svg' );
|
||||||
|
|
||||||
|
component.set({ width: 150, height: 50 });
|
||||||
|
assert.equal( target.innerHTML, `<svg><rect x="0" y="0" width="150" height="50"></rect></svg>` );
|
||||||
|
},
|
||||||
|
};
|
After Width: | Height: | Size: 179 B |
Loading…
Reference in new issue