Import Polymer classes instead of global ones in CommentApiMock

Change-Id: I01d619c73a6a15e6e789f41df55d7dfd7b292d77
This commit is contained in:
Dmitrii Filippov
2020-04-23 13:22:15 +02:00
parent 736175de0a
commit ba8fa47dbb

View File

@@ -14,41 +14,42 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
(function() {
'use strict';
class CommentApiMock extends Polymer.GestureEventListeners( import {GestureEventListeners} from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
Polymer.LegacyElementMixin( import {PolymerElement} from '@polymer/polymer/polymer-element.js';
Polymer.Element)) { import {LegacyElementMixin} from '@polymer/polymer/lib/legacy/legacy-element-mixin.js';
static get is() { return 'comment-api-mock'; }
static get properties() { class CommentApiMock extends GestureEventListeners(
return { LegacyElementMixin(
_changeComments: Object, PolymerElement)) {
}; static get is() { return 'comment-api-mock'; }
}
loadComments() { static get properties() {
return this._reloadComments(); return {
} _changeComments: Object,
};
/**
* For the purposes of the mock, _reloadDrafts is not included because its
* response is the same type as reloadComments, just makes less API
* requests. Since this is for test purposes/mocked data anyway, keep this
* file simpler by just using _reloadComments here instead.
*/
_reloadDraftsWithCallback(e) {
return this._reloadComments().then(() => e.detail.resolve());
}
_reloadComments() {
return this.$.commentAPI.loadAll(this._changeNum)
.then(comments => {
this._changeComments = this.$.commentAPI._changeComments;
});
}
} }
customElements.define(CommentApiMock.is, CommentApiMock); loadComments() {
})(); return this._reloadComments();
}
/**
* For the purposes of the mock, _reloadDrafts is not included because its
* response is the same type as reloadComments, just makes less API
* requests. Since this is for test purposes/mocked data anyway, keep this
* file simpler by just using _reloadComments here instead.
*/
_reloadDraftsWithCallback(e) {
return this._reloadComments().then(() => e.detail.resolve());
}
_reloadComments() {
return this.$.commentAPI.loadAll(this._changeNum)
.then(comments => {
this._changeComments = this.$.commentAPI._changeComments;
});
}
}
customElements.define(CommentApiMock.is, CommentApiMock);