Fix tests

This commit is contained in:
John Firebaugh
2013-01-24 11:20:51 -05:00
parent b6d8ddc2f8
commit 1be596c21b
5 changed files with 16 additions and 9 deletions
+9 -4
View File
@@ -38,12 +38,17 @@ describe('iD.Node', function () {
});
describe("#geometry", function () {
it("returns 'vertex' if the node is not a point", function () {
expect(iD.Node().geometry()).to.equal('vertex');
it("returns 'vertex' if the node is a member of any way", function () {
var node = iD.Node(),
way = iD.Way({nodes: [node.id]}),
graph = iD.Graph([node, way]);
expect(node.geometry(graph)).to.equal('vertex');
});
it("returns 'point' if the node is a point", function () {
expect(iD.Node({_poi: true}).geometry()).to.equal('point');
it("returns 'point' if the node is not a member of any way", function () {
var node = iD.Node(),
graph = iD.Graph([node]);
expect(node.geometry(graph)).to.equal('point');
});
});
});
+1 -1
View File
@@ -3,8 +3,8 @@ describe("iD.modes.AddPoint", function () {
beforeEach(function () {
container = d3.select('body').append('div');
map = iD.Map();
history = iD.History();
map = iD.Map().history(history);
controller = iD.Controller(map, history);
container.call(map);
+2 -1
View File
@@ -10,7 +10,8 @@ describe("iD.svg.Vertices", function () {
it("adds tag classes", function () {
var node = iD.Node({tags: {highway: "traffic_signals"}, loc: [0, 0]}),
graph = iD.Graph([node]);
way = iD.Way({nodes: [node.id]}),
graph = iD.Graph([node, way]);
surface.call(iD.svg.Vertices(projection), graph, [node], filter);
+3 -2
View File
@@ -1,10 +1,10 @@
describe("iD.ui.inspector", function () {
var inspector, element,
tags = {highway: 'residential'},
entity;
entity, graph;
function render() {
inspector = iD.ui.inspector();
inspector = iD.ui.inspector().graph(graph);
element = d3.select('body')
.append('div')
.attr('id', 'inspector-wrap')
@@ -14,6 +14,7 @@ describe("iD.ui.inspector", function () {
beforeEach(function () {
entity = iD.Entity({type: 'node', id: "n12345", tags: tags});
graph = iD.Graph([entity]);
render();
});