diff --git a/test/dom/as.mocha.js b/test/dom/as.mocha.js
index 5dd46d66..faba190f 100644
--- a/test/dom/as.mocha.js
+++ b/test/dom/as.mocha.js
@@ -34,7 +34,11 @@ describe('as', function() {
expect(fragment).html('
');
});
- it('HTML element `as-object` property', function() {
+ async function nextTick() {
+ return new Promise((resolve) => process.nextTick(resolve));
+ }
+
+ it('HTML element `as-object` property', async function() {
const { app } = runner.createHarness();
app.views.register('Body',
'' +
@@ -58,12 +62,18 @@ describe('as', function() {
expect(fragment).html('');
page.model.remove('_page.items', 1);
+
+ // templates.ts#L2342 not processing delete of property until nexttick
+ // https://github.com/derbyjs/derby/blob/master/src/templates/templates.ts#L2342-L2347
+ // unsure if this is a change since these were run in browser
+ await nextTick();
expect(page.nested.map).all.keys('a', 'c');
expect(page.nested.map.a).html('- A
');
expect(page.nested.map.c).html('- C
');
expect(fragment).html('');
page.model.unshift('_page.items', {id: 'd', text: 'D'});
+ await nextTick();
expect(page.nested.map).all.keys('a', 'c', 'd');
expect(page.nested.map.a).html('- A
');
expect(page.nested.map.c).html('- C
');
@@ -71,11 +81,12 @@ describe('as', function() {
expect(fragment).html('');
page.model.del('_page.items');
+ await nextTick();
expect(page.nested.map).eql({});
expect(fragment).html('');
});
- it('Component `as-object` property', function() {
+ it('Component `as-object` property', async function() {
const { app } = runner.createHarness();
app.views.register('Body',
'' +
@@ -107,6 +118,10 @@ describe('as', function() {
expect(fragment).html('');
page.model.remove('_page.items', 1);
+ // templates.ts#L2342 not processing delete of property until nexttick
+ // https://github.com/derbyjs/derby/blob/master/src/templates/templates.ts#L2342-L2347
+ // unsure if this is a change since these were run in browser
+ await nextTick();
expect(page.nested.map).all.keys('a', 'c');
expect(page.nested.map.a).instanceof(Item);
expect(page.nested.map.c).instanceof(Item);
@@ -115,6 +130,7 @@ describe('as', function() {
expect(fragment).html('');
page.model.unshift('_page.items', {id: 'd', text: 'D'});
+ await nextTick();
expect(page.nested.map).all.keys('a', 'c', 'd');
expect(page.nested.map.a).instanceof(Item);
expect(page.nested.map.c).instanceof(Item);
@@ -125,7 +141,7 @@ describe('as', function() {
expect(fragment).html('');
page.model.del('_page.items');
- console.log('_page.items', items.get());
+ await nextTick();
expect(page.nested.map).eql({});
expect(fragment).html('');
});