mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 22:48:10 +02:00
Test background and style
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script type="text/javascript" src="spec/util.js"></script>
|
||||
<script type="text/javascript" src="spec/background.js"></script>
|
||||
<script type="text/javascript" src="spec/way.js"></script>
|
||||
<script type="text/javascript" src="spec/map.js"></script>
|
||||
<script type="text/javascript" src="spec/hash.js"></script>
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user