mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-30 08:50:32 +02:00
Update tests for faux click events in more places.
This commit is contained in:
@@ -137,7 +137,7 @@
|
||||
iD.debug = true;
|
||||
mocha.setup({
|
||||
ui: 'bdd',
|
||||
globals: ['__onresize.tail-size']
|
||||
globals: ['__onresize.tail-size', '__onmousemove.zoom', '__onmouseup.zoom', '__onclick.draw']
|
||||
});
|
||||
var expect = chai.expect;
|
||||
</script>
|
||||
|
||||
@@ -29,21 +29,31 @@ describe("iD.behavior.Select", function() {
|
||||
container.remove();
|
||||
});
|
||||
|
||||
specify("click on entity selects the entity", function() {
|
||||
happen.click(context.surface().select('.' + a.id).node());
|
||||
expect(context.selection()).to.eql([a.id]);
|
||||
specify("click on entity selects the entity", function(done) {
|
||||
happen.mousedown(context.surface().select('.' + a.id).node());
|
||||
window.setTimeout(function() {
|
||||
expect(context.selection()).to.eql([a.id]);
|
||||
done();
|
||||
}, 600);
|
||||
});
|
||||
|
||||
specify("click on empty space clears the selection", function() {
|
||||
specify("click on empty space clears the selection", function(done) {
|
||||
context.enter(iD.modes.Select(context, [a.id]));
|
||||
happen.click(context.surface().node());
|
||||
expect(context.selection()).to.eql([]);
|
||||
happen.mousedown(context.surface().node());
|
||||
window.setTimeout(function() {
|
||||
expect(context.selection()).to.eql([]);
|
||||
done();
|
||||
}, 600);
|
||||
});
|
||||
|
||||
specify("shift-click on entity adds the entity to the selection", function() {
|
||||
specify("shift-click on entity adds the entity to the selection", function(done) {
|
||||
context.enter(iD.modes.Select(context, [a.id]));
|
||||
happen.click(context.surface().select('.' + b.id).node(), {shiftKey: true});
|
||||
expect(context.selection()).to.eql([a.id, b.id]);
|
||||
happen.mousedown(context.surface().select('.' + b.id).node(), {shiftKey: true});
|
||||
window.setTimeout(function() {
|
||||
expect(context.selection()).to.eql([a.id, b.id]);
|
||||
done();
|
||||
}, 600);
|
||||
});
|
||||
|
||||
specify("shift-click on empty space leaves the selection unchanged", function() {
|
||||
|
||||
@@ -17,13 +17,13 @@ describe("iD.modes.AddPoint", function() {
|
||||
describe("clicking the map", function () {
|
||||
it("adds a node", function() {
|
||||
happen.mousedown(context.surface().node(), {});
|
||||
happen.mouseup(window, {});
|
||||
happen.click(window, {});
|
||||
expect(context.changes().created).to.have.length(1);
|
||||
});
|
||||
|
||||
it("selects the node", function() {
|
||||
happen.mousedown(context.surface().node(), {});
|
||||
happen.mouseup(window, {});
|
||||
happen.click(window, {});
|
||||
expect(context.mode().id).to.equal('select');
|
||||
expect(context.mode().selection()).to.eql([context.changes().created[0].id]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user