创建两个 html div 元素,给一个 class="foo" 的属性。
DeepStrictEqual 断言它们是相等的。
为什么?
const jsdom = require("jsdom");
const {JSDOM} = jsdom;
var assert = require('assert');
global.document = new JSDOM(`<!DOCTYPE html>`).window.document;
describe.only('add_attributes to elem', function () {
it('test - same element different attributes', function () {
let testhtml = document.createElement('div');
testhtml.setAttribute('class', 'foo');
let testhtml2 = document.createElement('div');
//WHY ARE TWO DIFFERENT HTML ELEMENTS DEEP STRICT EQUAL.
assert.deepStrictEqual(testhtml, testhtml2);
});
it('test2 - different elements', function () {
let testhtml = document.createElement('div');
let testhtml2 = document.createElement('span');
//WHY ARE TWO DIFFERENT HTML ELEMENTS DEEP STRICT EQUAL.
assert.deepStrictEqual(testhtml, testhtml2);
});
});
紫衣仙女
慕哥9229398
相关分类