import { Component, View, Model } from "../../src/core";
describe("NgSwitch", function(){
describe("@Component + View + data-ng-switch", function(){
it( "renders the matching case", function() {
@Component({
tagName: "ng-component",
models: {
foo: new Model({ status: "active" })
},
template: `
` +
`Active` +
`Inactive` +
`
`
})
class TestView extends View {
}
let view = new TestView();
expect( view.render().el.textContent ).toBe( "Active" );
});
it( "renders the default case when nothing matches", function() {
@Component({
tagName: "ng-component",
models: {
foo: new Model({ status: "unknown" })
},
template: `` +
`Active` +
`Default` +
`
`
})
class TestView extends View {
}
let view = new TestView();
expect( view.render().el.textContent ).toBe( "Default" );
});
});
});