From 6b56bd0abad34a5c58dd641c450b6add778eecb0 Mon Sep 17 00:00:00 2001 From: Yuriy Yevstihnyeyev Date: Mon, 16 Jul 2018 16:23:13 +0300 Subject: [PATCH] Update the renderer args order and test for it --- src/vaadin-notification.html | 9 +++++++-- test/notification-renderer-test.html | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/vaadin-notification.html b/src/vaadin-notification.html index e86ff98..04b38c1 100644 --- a/src/vaadin-notification.html +++ b/src/vaadin-notification.html @@ -260,7 +260,12 @@ * * `owner` The host element of the renderer function. * - * **NOTE:** The renderer callback can be called several times with previous content available + * `model` null + * + * **NOTE:** The renderer callback can be called several times with previous content when available. + * + * **NOTE:** `notification` does not have any specific properties to pass with the `model` object, + * it is set to null. */ renderer: { type: Function, @@ -392,7 +397,7 @@ } if (renderer) { - this.renderer(this._card, this); + this.renderer(this._card, this, null); } else { this._ensureTemplatized(); } diff --git a/test/notification-renderer-test.html b/test/notification-renderer-test.html index 8f97466..025ed72 100644 --- a/test/notification-renderer-test.html +++ b/test/notification-renderer-test.html @@ -60,8 +60,11 @@ expect(notification._card.textContent.trim()).to.equal('renderer-content'); }); - it('renderer should receive notification as owner when it is defined', () => { - notification.renderer = (root, owner) => expect(owner).to.eql(notification); + it('renderer should receive notification as owner and null as model when defined', () => { + notification.renderer = (root, owner, model) => { + expect(owner).to.eql(notification); + expect(model).to.eql(null); + }; }); it('should use only renderer when template was assigned after renderer', done => {