import { RenderingTest, moduleFor } from '../utils/test-case';
import { set } from 'ember-metal';
import { strip } from '../utils/abstract-test-case';
moduleFor(
'SVG element tests',
class extends RenderingTest {
['@test unquoted viewBox property is output'](assert) {
let viewBoxString = '0 0 100 100';
this.render('
', {
model: {
viewBoxString,
},
});
this.assertInnerHTML(strip`
`);
this.runTask(() => this.rerender());
this.assertInnerHTML(strip`
`);
this.runTask(() => set(this.context, 'model.viewBoxString', null));
assert.equal(this.firstChild.getAttribute('svg'), null);
this.runTask(() => set(this.context, 'model', { viewBoxString }));
this.assertInnerHTML(strip`
`);
}
['@test quoted viewBox property is output'](assert) {
let viewBoxString = '0 0 100 100';
this.render('', {
model: {
viewBoxString,
},
});
this.assertInnerHTML(strip`
`);
this.runTask(() => this.rerender());
this.assertInnerHTML(strip`
`);
this.runTask(() => set(this.context, 'model.viewBoxString', null));
assert.equal(this.firstChild.getAttribute('svg'), null);
this.runTask(() => set(this.context, 'model', { viewBoxString }));
this.assertInnerHTML(strip`
`);
}
['@test quoted viewBox property is concat']() {
let viewBoxString = '100 100';
this.render('', {
model: {
viewBoxString,
},
});
this.assertInnerHTML(strip`
`);
this.runTask(() => this.rerender());
this.assertInnerHTML(strip`
`);
this.runTask(() => set(this.context, 'model.viewBoxString', '200 200'));
this.assertInnerHTML(strip`
`);
this.runTask(() => set(this.context, 'model', { viewBoxString }));
this.assertInnerHTML(strip`
`);
}
['@test class is output']() {
this.render("", {
model: {
color: 'blue',
},
});
this.assertInnerHTML(strip`
`);
this.runTask(() => this.rerender());
this.assertInnerHTML(strip`
`);
this.runTask(() => set(this.context, 'model.color', 'yellow'));
this.assertInnerHTML(strip`
`);
this.runTask(() => set(this.context, 'model', { color: 'blue' }));
this.assertInnerHTML(strip`
`);
}
}
);