import { component } from '../../src/fudgel.js';
component('custom-element', {
template: 'an {{internalValue}} {{where()}}'
}, class {
internalValue = 'internal value';
buttonClicked(event: Event) {
this.internalValue = `event (${event.type})`;
}
where() {
return 'here';
}
});
component('multi-bind', {
template: '
{{obj.one}}
{{obj.two}}
'
}, class {
obj = {
one: 'ONE',
two: 'TWO'
};
});
describe('text', () => {
it('replaces text in mustache-like syntax for text nodes and attributes', () => {
cy.mount('');
cy.get('#test').should('have.text', 'an internal value here');
cy.get('button').click();
cy.get('#test').should('have.text', 'an event (click) here');
});
it('works with multiple binds to the same object', () => {
cy.mount('');
cy.get('#one').should('have.text', 'ONE');
cy.get('#two').should('have.text', 'TWO');
});
});