fix more tests

pull/4444/head
Tan Li Hau 7 years ago committed by tanhauhau
parent 94da90ff15
commit e1f7c60ea9

@ -372,9 +372,9 @@ export default class ElementWrapper extends Wrapper {
}
get_claim_statement(nodes: Identifier) {
const attributes = this.node.attributes
.filter((attr) => attr.type === 'Attribute')
.map((attr) => p`${fix_attribute_casing(attr.name)}: true`);
const attributes = this.attributes
.filter((attr) => attr.node.type === 'Attribute' && !attr.get_property_name())
.map((attr) => p`${fix_attribute_casing(attr.node.name)}: true`);
const name = this.node.namespace
? this.node.name

@ -146,8 +146,6 @@ describe('runtime', () => {
throw err;
}
if (config.before_test) config.before_test();
// Put things we need on window for testing
window.SvelteComponent = SvelteComponent;
@ -160,10 +158,11 @@ describe('runtime', () => {
const SsrSvelteComponent = require(`./samples/${dir}/main.svelte`).default;
const { html } = SsrSvelteComponent.render(config.props);
target.innerHTML = html;
delete compileOptions.generate;
}
if (config.before_test) config.before_test();
const warnings = [];
const warn = console.warn;
console.warn = warning => {
@ -193,9 +192,7 @@ describe('runtime', () => {
throw new Error('Received unexpected warnings');
}
if (hydrate && config.ssrHtml) {
assert.htmlEqual(target.innerHTML, config.ssrHtml);
} else if (config.html) {
if (config.html) {
assert.htmlEqual(target.innerHTML, config.html);
}

@ -11,6 +11,9 @@ export default {
html: '<p>potato</p>',
before_test() {
count = 0;
},
test({ assert, component, target }) {
assert.equal(count, 1);

@ -17,6 +17,11 @@ export default {
html: '<p>potato</p>',
before_test() {
count_a = 0;
count_b = 0;
},
test({ assert, component, target }) {
assert.equal(count_a, 1);
assert.equal(count_b, 0);

@ -2,7 +2,9 @@ import order from './order.js';
export default {
skip_if_ssr: true,
before_test() {
order.length = 0;
},
test({ assert, component, target, compileOptions }) {
if (compileOptions.hydratable) {
assert.deepEqual(order, [
@ -43,7 +45,5 @@ export default {
'0: afterUpdate'
]);
}
order.length = 0;
}
};

@ -3,6 +3,9 @@ import order from './order.js';
export default {
skip_if_ssr: true,
before_test() {
order.length = 0;
},
test({ assert }) {
assert.deepEqual(order, [
'beforeUpdate',
@ -10,7 +13,5 @@ export default {
'onMount',
'afterUpdate'
]);
order.length = 0;
}
};

@ -1,9 +1,14 @@
export default {
skip_if_ssr: true,
html: `
<div>foo</div>
<div>foo<div>foo</div></div>
`
`,
ssrHtml: `
<noscript>foo</noscript>
<div>foo<noscript>foo</noscript></div>
<div>foo<div>foo<noscript>foo</noscript></div></div>
`
};

Loading…
Cancel
Save