From 48f703ff32acaff25c7da1a2092bdf32cec2538b Mon Sep 17 00:00:00 2001 From: Bede Overend Date: Fri, 1 Dec 2017 13:29:12 +1100 Subject: [PATCH 1/3] Convert to mixin for v1 components --- bower.json | 5 +- package.json | 1 + simpla-element-behavior.html | 349 +++++++++++++++++++- src/simpla-element-behavior.html | 517 +++++++++++++++--------------- test/simpla-element-behavior.html | 266 ++++++--------- yarn.lock | 72 ++++- 6 files changed, 784 insertions(+), 426 deletions(-) diff --git a/bower.json b/bower.json index b4322e0..5a08b41 100644 --- a/bower.json +++ b/bower.json @@ -23,6 +23,9 @@ ], "devDependencies": { "web-component-tester": "^4.0.0", - "polymer": "^1.8.0" + "polymer": "^2.2.0" + }, + "resolutions": { + "webcomponentsjs": "^v1.0.2" } } diff --git a/package.json b/package.json index 6a882a7..7d9a513 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "gulp-process-inline": "^0.1.1", "gulp-size": "^2.0.0", "run-sequence": "^1.1.5", + "simpla": "^3.0.1", "web-component-tester": "^5.0.0", "yargs": "^7.1.0" } diff --git a/simpla-element-behavior.html b/simpla-element-behavior.html index 5a0d678..efe2de3 100644 --- a/simpla-element-behavior.html +++ b/simpla-element-behavior.html @@ -1 +1,348 @@ - \ No newline at end of file + diff --git a/src/simpla-element-behavior.html b/src/simpla-element-behavior.html index 8305350..ef99838 100644 --- a/src/simpla-element-behavior.html +++ b/src/simpla-element-behavior.html @@ -1,275 +1,270 @@ diff --git a/test/simpla-element-behavior.html b/test/simpla-element-behavior.html index 419cbc4..df88a31 100755 --- a/test/simpla-element-behavior.html +++ b/test/simpla-element-behavior.html @@ -6,18 +6,15 @@ - + + - - - - - + + - + \ No newline at end of file From 921ed481d3a8eb4a80fee67653f9454627b40461 Mon Sep 17 00:00:00 2001 From: Bede Overend Date: Fri, 1 Dec 2017 14:01:34 +1100 Subject: [PATCH 3/3] Revert to original loaded behaviour --- simpla-element-behavior.html | 2 +- src/simpla-element-behavior.html | 13 +++++-------- test/simpla-element-behavior.html | 17 ++++++++++++----- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/simpla-element-behavior.html b/simpla-element-behavior.html index 71744fa..79769a9 100644 --- a/simpla-element-behavior.html +++ b/simpla-element-behavior.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/simpla-element-behavior.html b/src/simpla-element-behavior.html index ef99838..4085e17 100644 --- a/src/simpla-element-behavior.html +++ b/src/simpla-element-behavior.html @@ -166,13 +166,13 @@ if (isEmpty && bufferIsClean) { // Load static content - this._protectedSetCallback().then(() => { - this._loaded = true; - }); + this._protectedSetCallback(); } else { this._protectedGetCallback(item); - this._loaded = true; } + + this._loaded = true; + }); this._observeSimplaBuffer(path); @@ -238,17 +238,14 @@ * @return {undefined} */ _protectedSetCallback() { - let done = Promise.resolve(); if (!this.__loadingFromSimpla && this.isConnected && this.path) { let data = this.updateSimplaBuffer(), { type } = this.constructor.simplaConfig; if (typeof data !== 'undefined' || data === null) { - done = Simpla.set(this.path, { type, data }); + Simpla.set(this.path, { type, data }); } } - - return done; } /** diff --git a/test/simpla-element-behavior.html b/test/simpla-element-behavior.html index df88a31..25ef9d8 100755 --- a/test/simpla-element-behavior.html +++ b/test/simpla-element-behavior.html @@ -321,12 +321,19 @@ }); it(`should set content into the buffer if no content is available`, () => { - component.path = path; - - return waitForLoaded(component) + return Promise.resolve() + // Make sure buffer is filled .then(() => Simpla.get(path)) - .then((content) => { - expect(content.data.text).to.equal(component.text); + .then(() => { + return new Promise(resolve => { + let observer = Simpla.observe(path, item => { + expect(item.data.text).to.equal(component.text); + observer.unobserve(); + resolve(); + }); + + component.path = path; + }); }); });