-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ComponentTester] ref + innerhtml not working #91
Comments
With test: import { bootstrap } from 'aurelia-bootstrapper';
import { ComponentTester, StageComponent, waitForDocumentElement } from 'aurelia-testing';
describe('Icon', () => {
let component: ComponentTester;
describe('component', () => {
beforeEach(() => {
component = StageComponent.withResources('my-icon').inView('<my-icon name="angle-up"></my-icon>');
});
it('should render svg icon with href', async () => {
await component.create(bootstrap);
const myIcon = await waitForDocumentElement('my-icon')
expect(myIcon.innerHTML.trim()).toContain('href="src/assets/stack.svg#angle-up"');
});
afterEach(() => {
try {
component.dispose()
} catch {
console.log('dispose error')
}
});
});
}); It works fine. I think there's something wrong with Jest. |
@michaelw85 The above is for your |
@bigopon 😲 thx for the reply I did not consider Jest to cause the issue... 🤔 I wonder what it could be. |
@michaelw85 maybe Jest is not the issue, but the combination of Jest and a few other stuff? In anyway, I think for normal looking templates, it will & should work just fine |
I might investigate a bit more at a later point in time. First thing that pops in my mind is if it might be related to |
I'm submitting a bug report
ref and innerhtml not working when using the component tester.
au jest will result in an error for the ref issue.
the innerhtml issue is visible in the jest snapshot.
To verify the icons are actually functioning in a normal app use
au run
to open the dev-app.aurelia-testing: 1.0.0
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
v10.15.0
6.9.0
JSPM OR Webpack AND Version
Plugin setup created with CLI, default TS configuration
Language:
TS
Current behavior:
When using a ref binding it is undefined in a unit test when using the component tester.
TypeError: Cannot read property 'setAttribute' of undefined
(setAttribute is performed on the elements being referenced)innerhtml is not rendered, here's a jest snapshot:
Expected/desired behavior:
ref should work when using the component tester.
innerhtml binding should render when using component tester.
The text was updated successfully, but these errors were encountered: