Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { defineComponent, jitSuite, RenderTest, test, tracked } from '../..';

class InlineIfTest extends RenderTest {
static suiteName = 'inline {{if}} keyword';

@test
'inline if can swap render components'() {
class State {
@tracked cond = true;
flip = () => (this.cond = !this.cond);
}

let state = new State();

const Foo = defineComponent({}, 'Foo');
const ooF = defineComponent({}, 'ooF');
const Bar = defineComponent({ Foo, ooF, state }, '{{if state.cond Foo ooF}}');

this.renderComponent(Bar);

this.assertHTML('Foo');

state.flip();
this.rerender();
this.assertHTML('ooF');

state.flip();
this.rerender();
this.assertHTML('Foo');
}
}

jitSuite(InlineIfTest);
Loading