From a74157cb717362d5ad0c89262c62f2876e8180bc Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sat, 1 Oct 2016 10:33:13 -0400 Subject: [PATCH] Add test for nonnumeric layer tag (see #3405) --- test/spec/core/way.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/spec/core/way.js b/test/spec/core/way.js index e39795743..307a7c911 100644 --- a/test/spec/core/way.js +++ b/test/spec/core/way.js @@ -206,6 +206,12 @@ describe('iD.Way', function() { expect(iD.Way().layer()).to.equal(0); }); + it('returns 0 when the way has a non numeric layer tag', function() { + expect(iD.Way({tags: { layer: 'NaN' }}).layer()).to.equal(0); + expect(iD.Way({tags: { layer: 'Infinity' }}).layer()).to.equal(0); + expect(iD.Way({tags: { layer: 'Foo' }}).layer()).to.equal(0); + }); + it('returns the layer when the way has an explicit layer tag', function() { expect(iD.Way({tags: { layer: '2' }}).layer()).to.equal(2); expect(iD.Way({tags: { layer: '-5' }}).layer()).to.equal(-5);