Fix tests

This commit is contained in:
John Firebaugh
2013-05-13 13:04:13 -07:00
parent 1a6a9b5b9e
commit ba08ba6109
2 changed files with 27 additions and 13 deletions
+24 -13
View File
@@ -9,20 +9,7 @@ describe("iD.behavior.Hover", function() {
container.remove();
});
describe("#on", function () {
it("adds the .behavior-hover class to the selection", function () {
container.call(iD.behavior.Hover());
expect(container).to.be.classed('behavior-hover')
});
});
describe("#off", function () {
it("removes the .behavior-hover class from the selection", function () {
container.classed('behavior-hover', true);
container.call(iD.behavior.Hover().off);
expect(container).not.to.be.classed('behavior-hover')
});
it("removes the .hover class from all elements", function () {
container.append('span').attr('class', 'hover');
container.call(iD.behavior.Hover().off);
@@ -69,4 +56,28 @@ describe("iD.behavior.Hover", function() {
expect(container.selectAll('.hover')[0]).to.have.length(0);
});
});
describe("alt keydown", function () {
it("replaces the .hover class with .hover-suppressed", function () {
container.append('span').attr('class', 'hover');
container.call(iD.behavior.Hover().altDisables(true));
happen.keydown(document, {keyCode: 18});
expect(container.selectAll('.hover')[0]).to.have.length(0);
expect(container.selectAll('.hover-suppressed')[0]).to.have.length(1);
});
});
describe("alt keyup", function () {
it("replaces the .hover-suppressed class with .hover", function () {
container.append('span').attr('class', 'hover-suppressed');
container.call(iD.behavior.Hover().altDisables(true));
happen.keyup(document, {keyCode: 18});
expect(container.selectAll('.hover')[0]).to.have.length(1);
expect(container.selectAll('.hover-suppressed')[0]).to.have.length(0);
});
});
});
+3
View File
@@ -202,6 +202,8 @@ describe('iD.Map', function() {
specify('hovered ways use draw-connect-line cursor in draw modes', function() {
behavior.attr('class', 'behavior-hover');
line.classed('hover', true);
area.classed('hover', true);
mode.attr('class', 'mode-draw-line');
expect(cursor(line)).to.match(/cursor-draw-connect-line/);
expect(cursor(area)).to.match(/cursor-draw-connect-line/);
@@ -221,6 +223,7 @@ describe('iD.Map', function() {
specify('hovered vertices use draw-connect-vertex cursor in draw modes', function() {
behavior.attr('class', 'behavior-hover');
vertex.classed('hover', true);
mode.attr('class', 'mode-draw-line');
expect(cursor(vertex)).to.match(/cursor-draw-connect-vertex/);
mode.attr('class', 'mode-draw-area');