You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/runtime/samples/binding-this-unset/_config.js

24 lines
593 B

export default {
props: {
x: true
},
html: '<canvas data-x="true"></canvas>',
test({ assert, component, target }) {
let canvas = target.querySelector('canvas');
assert.equal(canvas, component.foo);
assert.equal(canvas.getAttribute('data-x'), 'true');
component.x = false;
canvas = target.querySelector('canvas');
assert.equal(canvas, component.foo);
assert.equal(canvas.getAttribute('data-x'), 'false');
component.x = true;
canvas = target.querySelector('canvas');
assert.equal(canvas, component.foo);
assert.equal(canvas.getAttribute('data-x'), 'true');
}
};