【发布时间】:2019-11-10 01:26:53
【问题描述】:
如何将 dom 对象从我的 beforeEach() 函数传递给我的测试?
例如:
describe('2) Key DOM elements exist', function() {
beforeEach(function(done){
JSDOM.fromURL('http://localhost:3000/', ).then(dom => {
this.hello = dom;
});
done();
});
it('a) Header element is present', function() {
console.log(hello);
const header = dom.window.document.getElementById('header');
expect(header).to.exist;
})
});
【问题讨论】:
标签: javascript mocha.js tdd chai