Fix auto-insert into converse-root
This commit is contained in:
parent
b8d710800a
commit
7407a5a681
|
@ -5,11 +5,12 @@ const u = converse.env.utils;
|
|||
describe("Converse", function() {
|
||||
|
||||
it("Can be inserted into a custom element after having been initialized",
|
||||
mock.initConverse([], {'root': new DocumentFragment()}, async (done) => {
|
||||
mock.initConverse([], {'root': new DocumentFragment()}, async (done, _converse) => {
|
||||
|
||||
expect(document.body.querySelector('div#conversejs')).toBe(null);
|
||||
expect(document.body.querySelector('#conversejs')).toBe(null);
|
||||
expect(_converse.root.firstElementChild.nodeName.toLowerCase()).toBe('converse-root');
|
||||
document.body.appendChild(document.createElement('converse-root'));
|
||||
await u.waitUntil(() => document.body.querySelector('div#conversejs') !== null);
|
||||
await u.waitUntil(() => document.body.querySelector('#conversejs') !== null);
|
||||
done();
|
||||
}));
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ class ConverseRoot extends CustomElement {
|
|||
connectedCallback () {
|
||||
super.connectedCallback();
|
||||
this.classList.add(`converse-${api.settings.get('view_mode')}`);
|
||||
this.setAttribute('id', 'conversejs');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue