From e788cbefc38ad40034970b68e3471f9a8978ec09 Mon Sep 17 00:00:00 2001 From: Sean Tymon Date: Thu, 15 Jun 2017 21:46:45 +0100 Subject: [PATCH] update changelog and add test --- changes.md | 6 ++++++ src/angular-locker.js | 4 ++-- test/spec/angular-locker.spec.js | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/changes.md b/changes.md index 8524471..b61d37f 100644 --- a/changes.md +++ b/changes.md @@ -1,3 +1,9 @@ +### 2.0.5 + +##### Fixes + +- Fix compatibility with latest Chrome #38 + ### 2.0.4 ##### Fixes diff --git a/src/angular-locker.js b/src/angular-locker.js index a949902..4aed88d 100644 --- a/src/angular-locker.js +++ b/src/angular-locker.js @@ -341,8 +341,8 @@ if (! this._checkSupport()) { _error('The browser does not support the "' + options.driver + '" driver'); } - /*D2NOVA Stephen Chen: hasOwnProperty() method doesn't work on MacOS latest Chrome Version v60.0.3080.5 */ - return this._driver.hasOwnProperty(this._getPrefix(_value(key))) || this._getItem(key); + + return this._driver.hasOwnProperty(this._getPrefix(_value(key))) || !! this._getItem(key); }; /** diff --git a/test/spec/angular-locker.spec.js b/test/spec/angular-locker.spec.js index 7068194..d862f57 100644 --- a/test/spec/angular-locker.spec.js +++ b/test/spec/angular-locker.spec.js @@ -631,6 +631,14 @@ describe('angular-locker', () => { }).toThrowError(); })); + it('should check an item exists when hasOwnProperty does not work', inject((locker) => { + locker.namespace('differentNs').put('randKeyNs', Math.random()); + spyOn(locker._driver, 'hasOwnProperty').and.returnValue(void 0); + + expect( locker.namespace('differentNs').has('randKeyNs') ).toBeTruthy(); + expect( locker.namespace('loremipsumdolorsitamet').has('randKeyNs') ).toBeFalsy(); + })); + }); describe('checking browser support', () => {