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

39 lines
814 B

import * as path from 'path';
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() {
delete require.cache[path.resolve(__dirname, 'data.js')];
},
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>
`);
}
};