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

View File

@@ -14,7 +14,6 @@
<script src="lib/sinon-chai.js"></script>
<script src="lib/bind-shim.js"></script>
<script src="lib/happen.js"></script>
<script src="lib/rtree.js"></script>
<!-- include source files here... -->
<script src='../js/lib/lodash.js'></script>
@@ -29,6 +28,7 @@
<script src='../js/lib/d3.tail.js'></script>
<script src='../js/lib/ohauth.js'></script>
<script src='../js/lib/jxon.js'></script>
<script src="../js/lib/rtree.js"></script>
<script src='../js/id/id.js'></script>
<script src='../js/id/util.js'></script>

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');
});
});
});

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);

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);

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();
});