diff --git a/test/index.html b/test/index.html index c5461c316..33e0ebd73 100644 --- a/test/index.html +++ b/test/index.html @@ -49,6 +49,7 @@ + diff --git a/test/spec/Entity.js b/test/spec/Entity.js index deebe986e..a13036f0b 100644 --- a/test/spec/Entity.js +++ b/test/spec/Entity.js @@ -12,6 +12,12 @@ describe('Entity', function () { e = iD.Entity().update({tags: tags}); expect(e.tags).toBe(tags); }); + + it("tags the entity as updated", function () { + var tags = {foo: 'bar'}, + e = iD.Entity().update({tags: tags}); + expect(e._updated).toBe(true); + }); }); describe("#created", function () { diff --git a/test/spec/background.js b/test/spec/background.js new file mode 100644 index 000000000..c36662e4c --- /dev/null +++ b/test/spec/background.js @@ -0,0 +1,37 @@ +describe('Background', function() { + var c, d; + + beforeEach(function() { + d = d3.select(document.createElement('div')); + c = iD.Background() + .projection(d3.geo.mercator()); + d.call(c); + }); + + afterEach(function() { + d.remove(); + }); + + describe('iD.Background', function() { + it('is instantiated', function() { + expect(c).toBeTruthy(); + }); + + it('#size', function() { + expect(c.size([100, 100])).toEqual(c); + expect(c.size()).toEqual([100,100]); + }); + + it('#source', function() { + expect(c.source(iD.Background.Bing)).toEqual(c); + expect(c.source()).toEqual(iD.Background.Bing); + }); + }); + + describe('iD.Background.Bing', function() { + it('generates tiles', function() { + expect(iD.Background.Bing([0,0,0])).toEqual('http://ecn.t0.tiles.virtualearth.net/tiles/a.jpeg?g=587&mkt=en-gb&n=z'); + }); + }); + +}); diff --git a/test/spec/style.js b/test/spec/style.js new file mode 100644 index 000000000..115b7ff78 --- /dev/null +++ b/test/spec/style.js @@ -0,0 +1,16 @@ +describe('Style', function() { + describe('#waystack', function() { + it('stacks bridges over non-bridges', function() { + var a = { tags: { bridge: 'yes' } }, + b = { tags: {} }; + expect(iD.Style.waystack(a, b)).toEqual(1); + expect(iD.Style.waystack(b, a)).toEqual(-1); + }); + it('stacks layers', function() { + var a = { tags: { layer: 1 } }, + b = { tags: { layer: 0 } }; + expect(iD.Style.waystack(a, b)).toEqual(1); + expect(iD.Style.waystack(b, a)).toEqual(-1); + }); + }); +});