liqiang372
- Node 8+
- NPM or yarn
- Git
- Safari, Chrome, Firefox
cd topcoder-jest-test
git checkout svg-baseVal
npm install
npm run test
npm run test:jest
Chrome, Safari, Firefox
Browser | Result |
---|---|
Chrome 72.0.3626 (Mac OS X 10.13.4) | success |
Safari 11.1.0 (Mac OS X 10.13.4) | success |
Firefox 65.0.0 (Mac OS X 10.13.0) | success |
FAIL src/app/app.component.spec.ts
AppComponent
✕ should test svg attributes (89ms)
● AppComponent › should test svg attributes
TypeError: Cannot read property 'baseVal' of undefined
19 | const fixture = TestBed.createComponent(AppComponent);
20 | const svg = fixture.nativeElement.querySelector('#my-svg');
> 21 | expect(svg.transform.baseVal.consolidate().matrix).to.have.property('translate');
| ^
22 |
23 | });
24 | });
at src/app/app.component.spec.ts:21:26
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 2.738s
expect(svg.transform.baseVal.consolidate().matrix).to.have.property('translate');
JSDom doesn't support well on svg, and transform
property is an example of this
jsdom/jsdom#2531