Skip to content

Commit

Permalink
#5377 child first and parent first tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiu committed Apr 2, 2024
1 parent 5ad43a7 commit 2f35fae
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions test/components/files/component/Base.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
StartTest(t => {
t.it('Checking colliding vdom updates', async t => {
Neo.worker.App.createNeoInstance({
const containerId = await Neo.worker.App.createNeoInstance({
ntype : 'container',
height: 250,
style : {backgroundColor: 'red'},
width : 300
});

t.is(containerId, 'neo-container-1');

await t.waitForSelector('.neo-container');
t.diag('Container got rendered.')
t.diag('Container got rendered.');

const componentId = await Neo.worker.App.createNeoInstance({
ntype : 'component',
height : 150,
parentId: containerId,
style : {backgroundColor: 'blue'},
width : 150
});

t.is(componentId, 'neo-component-1');
t.diag('Component got rendered.');

t.diag('Child update before parent update');
Neo.worker.App.setConfigs({id: componentId, style: {backgroundColor: 'green'}});
Neo.worker.App.setConfigs({id: containerId, style: {backgroundColor: 'orange'}});

await t.waitFor(100);

t.is(document.getElementById(componentId).style.backgroundColor, 'green');
t.is(document.getElementById(containerId).style.backgroundColor, 'orange');

t.diag('Parent update before child update');
Neo.worker.App.setConfigs({id: containerId, style: {backgroundColor: 'pink'}});
Neo.worker.App.setConfigs({id: componentId, style: {backgroundColor: 'purple'}});

await t.waitFor(100);

t.is(document.getElementById(containerId).style.backgroundColor, 'pink');
t.is(document.getElementById(componentId).style.backgroundColor, 'purple');
});
});

0 comments on commit 2f35fae

Please sign in to comment.