mirror of https://github.com/sveltejs/svelte
parent
b5102f4f1b
commit
9b80eee51a
@ -1,19 +1,21 @@
|
||||
export default {
|
||||
solo: true,
|
||||
|
||||
html: `<div data-foo="bar">red</div>`,
|
||||
html: `<div data-named="value" data-foo="bar">red</div>`,
|
||||
|
||||
test ( assert, component, target ) {
|
||||
const div = target.querySelector( 'div' );
|
||||
|
||||
assert.equal( div.dataset.foo, 'bar' );
|
||||
assert.equal( div.dataset.named, 'value' );
|
||||
|
||||
component.set({ color: 'blue', props: { 'data-foo': 'baz' } });
|
||||
assert.equal( target.innerHTML, `<div data-foo="baz">blue</div>` );
|
||||
component.set({ color: 'blue', props: { 'data-foo': 'baz', 'data-named': 'qux' } });
|
||||
assert.equal( target.innerHTML, `<div data-named="value" data-foo="baz">blue</div>` );
|
||||
assert.equal( div.dataset.foo, 'baz' );
|
||||
assert.equal( div.dataset.named, 'value' );
|
||||
|
||||
component.set({ color: 'blue', props: {} });
|
||||
assert.equal( target.innerHTML, `<div>blue</div>` );
|
||||
assert.equal( target.innerHTML, `<div data-named="value">blue</div>` );
|
||||
assert.equal( div.dataset.foo, undefined );
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in new issue