[Breaking Change] Make 'is' type-safe.

This commit is contained in:
Bjorn Stromberg 2020-06-21 01:08:36 +09:00
parent 1ffe2fb6a7
commit b0b33a07d6
2 changed files with 23 additions and 14 deletions

View file

@ -1275,19 +1275,19 @@ test('is.domElement', t => {
assert.domElement({nodeType: 1, nodeName: 'div'});
});
const htmlTagNameToTypeName = {
div: 'HTMLDivElement',
input: 'HTMLInputElement',
span: 'HTMLSpanElement',
img: 'HTMLImageElement',
canvas: 'HTMLCanvasElement',
script: 'HTMLScriptElement'
};
const tagNames = [
'div',
'input',
'span',
'img',
'canvas',
'script'
];
for (const [tagName, typeName] of Object.entries(htmlTagNameToTypeName)) {
tagNames.forEach(tagName => {
const domElement = createDomElement(tagName);
t.is(is(domElement), typeName);
}
t.is(is(domElement), 'HTMLElement');
});
});
test('is.observable', t => {