test(ivy): add testing for namespaced attributes (#23899)
PR Close #23899
This commit is contained in:
parent
856ee73464
commit
e994b11105
|
@ -521,6 +521,22 @@ describe('instructions', () => {
|
||||||
'<div id="container" style="background: rgb(222, 173, 17);" title="abc" whatever="wee" shazbot="wocka wocka"></div>';
|
'<div id="container" style="background: rgb(222, 173, 17);" title="abc" whatever="wee" shazbot="wocka wocka"></div>';
|
||||||
|
|
||||||
expect([standardHTML, ieHTML]).toContain(t.html);
|
expect([standardHTML, ieHTML]).toContain(t.html);
|
||||||
|
|
||||||
|
const div = t.hostElement.querySelector('#container');
|
||||||
|
expect(div !.attributes.length).toBe(5);
|
||||||
|
|
||||||
|
const expectedAttributes: {[key: string]: string} = {
|
||||||
|
'id': 'container',
|
||||||
|
'http://www.example.com/2014/test:title': 'abc',
|
||||||
|
'style': 'background: #dead11',
|
||||||
|
'http://www.example.com/2014/test:whatever': 'wee',
|
||||||
|
'http://www.whatever.com/2016/blah:shazbot': 'wocka wocka',
|
||||||
|
};
|
||||||
|
|
||||||
|
Array.from(div !.attributes).forEach(attr => {
|
||||||
|
const key = attr.namespaceURI ? attr.namespaceURI + ':' + attr.name : attr.name;
|
||||||
|
expect(attr.value).toEqual(expectedAttributes[key]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue