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/reactive-import-statement/_config.js

45 lines
799 B

import { reset_numbers } from './data';
export default {
html: `
import
<p>1 + 2 + 3 + 4 = 10</p>
local
<p>1 + 2 + 3 + 4 = 10</p>
<button>Add a number</button>
`,
before_test() {
reset_numbers();
},
async test({ assert, target, window }) {
const btn = target.querySelector('button');
const clickEvent = new window.MouseEvent('click');
await btn.dispatchEvent(clickEvent);
assert.htmlEqual(
target.innerHTML,
`
import
<p>1 + 2 + 3 + 4 + 5 = 15</p>
local
<p>1 + 2 + 3 + 4 + 5 = 15</p>
<button>Add a number</button>
`
);
await btn.dispatchEvent(clickEvent);
assert.htmlEqual(
target.innerHTML,
`
import
<p>1 + 2 + 3 + 4 + 5 + 6 = 21</p>
local
<p>1 + 2 + 3 + 4 + 5 + 6 = 21</p>
<button>Add a number</button>
`
);
}
};