test(ct-angular): improve output listener update test
This commit is contained in:
parent
eefd6ea3a2
commit
d83f9ee4a9
|
|
@ -19,29 +19,27 @@ test('emit an submit event when the button is clicked', async ({ mount }) => {
|
||||||
test('replace existing listener when new listener is set', async ({
|
test('replace existing listener when new listener is set', async ({
|
||||||
mount,
|
mount,
|
||||||
}) => {
|
}) => {
|
||||||
let count = 0;
|
let called = false;
|
||||||
|
|
||||||
const component = await mount(ButtonComponent, {
|
const component = await mount(ButtonComponent, {
|
||||||
props: {
|
props: {
|
||||||
title: 'Submit',
|
title: 'Submit',
|
||||||
},
|
},
|
||||||
on: {
|
on: {
|
||||||
submit() {
|
submit() {},
|
||||||
count++;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
component.update({
|
component.update({
|
||||||
on: {
|
on: {
|
||||||
submit() {
|
submit() {
|
||||||
count++;
|
called = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
await component.click();
|
await component.click();
|
||||||
expect(count).toBe(1);
|
expect(called).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('unsubscribe from events when the component is unmounted', async ({
|
test('unsubscribe from events when the component is unmounted', async ({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue