export default {
props: {
thePromise: new Promise((_) => {}),
count: 0,
},
html: `
`,
async test({ assert, component, target }) {
await (component.thePromise = Promise.resolve({ value: "success", Component: component.Component }));
assert.htmlEqual(
target.innerHTML,
`
Resolved:
count: 0
value: success
`
);
component.count = 5;
assert.htmlEqual(
target.innerHTML,
`
Resolved:
count: 5
value: success
`
);
try {
await (component.thePromise = Promise.reject({ value: "failure", Component: component.Component }));
} catch (error) {
// ignore
}
assert.htmlEqual(
target.innerHTML,
`
Rejected:
count: 5
value: failure
`
);
component.count = 10;
assert.htmlEqual(
target.innerHTML,
`
Rejected:
count: 10
value: failure
`
);
},
};