import { component, defineRouterComponent, rootElement } from '../../src/fudgel.js'; defineRouterComponent('app-router'); component('test-element', { template: 'YESNO', }, class { value = false; toggle() { this.value = !this.value; } }); component('test-undefined', { template: 'WRONGRIGHT' }); component('test-for-if', { template: `
{{item.name}}
` }, class { list = [ { show: true, name: "first" }, { show: false, name: "second" }, { show: true, name: "third" }]; }); describe('if', () => { it('toggles based on an internal value', () => { cy.mount(''); cy.get('#falsy').should('exist'); cy.get('#truthy').should('not.exist'); cy.get('button').click(); cy.get('#truthy').should('exist'); cy.get('#falsy').should('not.exist'); cy.get('button').click(); cy.get('#truthy').should('not.exist'); cy.get('#falsy').should('exist'); }); it('handles undefined', () => { cy.mount(''); cy.get('#right').should('exist'); cy.get('#wrong').should('not.exist'); }); it('works with nesting and direct mounting', () => { cy.mount(''); cy.get('#first').should('exist'); cy.get('#second').should('not.exist'); cy.get('#third').should('exist'); }); });