mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 22:48:10 +02:00
Merge branch 'edit_menu'
This commit is contained in:
@@ -43,14 +43,14 @@ describe('iD.behaviorHash', function () {
|
||||
location.hash = 'map=20.00/38.87952/-77.02405';
|
||||
});
|
||||
|
||||
it('stores the current zoom and coordinates in location.hash on map move events', function () {
|
||||
it('stores the current zoom and coordinates in location.hash on map move events', function (done) {
|
||||
location.hash = '';
|
||||
hash();
|
||||
var clock = sinon.useFakeTimers();
|
||||
context.map().center([-77.0, 38.9]);
|
||||
context.map().zoom(2.0);
|
||||
clock.tick(500);
|
||||
expect(location.hash).to.equal('#map=2.00/38.9/-77.0');
|
||||
clock.restore();
|
||||
window.setTimeout(function() {
|
||||
expect(location.hash).to.equal('#map=2.00/38.9/-77.0');
|
||||
done();
|
||||
}, 300);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,37 +44,49 @@ describe('iD.behaviorSelect', function() {
|
||||
});
|
||||
|
||||
specify('click on entity selects the entity', function() {
|
||||
happen.click(context.surface().selectAll('.' + a.id).node());
|
||||
var el = context.surface().selectAll('.' + a.id).node();
|
||||
happen.mousedown(el);
|
||||
happen.mouseup(el);
|
||||
expect(context.selectedIDs()).to.eql([a.id]);
|
||||
});
|
||||
|
||||
specify('click on empty space clears the selection', function() {
|
||||
context.enter(iD.modeSelect(context, [a.id]));
|
||||
happen.click(context.surface().node());
|
||||
var el = context.surface().node();
|
||||
happen.mousedown(el);
|
||||
happen.mouseup(el);
|
||||
expect(context.mode().id).to.eql('browse');
|
||||
});
|
||||
|
||||
specify('shift-click on unselected entity adds it to the selection', function() {
|
||||
context.enter(iD.modeSelect(context, [a.id]));
|
||||
happen.click(context.surface().selectAll('.' + b.id).node(), {shiftKey: true});
|
||||
var el = context.surface().selectAll('.' + b.id).node();
|
||||
happen.mousedown(el, { shiftKey: true });
|
||||
happen.mouseup(el, { shiftKey: true });
|
||||
expect(context.selectedIDs()).to.eql([a.id, b.id]);
|
||||
});
|
||||
|
||||
specify('shift-click on selected entity removes it from the selection', function() {
|
||||
context.enter(iD.modeSelect(context, [a.id, b.id]));
|
||||
happen.click(context.surface().selectAll('.' + b.id).node(), {shiftKey: true});
|
||||
var el = context.surface().selectAll('.' + b.id).node();
|
||||
happen.mousedown(el, { shiftKey: true });
|
||||
happen.mouseup(el, { shiftKey: true });
|
||||
expect(context.selectedIDs()).to.eql([a.id]);
|
||||
});
|
||||
|
||||
specify('shift-click on last selected entity clears the selection', function() {
|
||||
context.enter(iD.modeSelect(context, [a.id]));
|
||||
happen.click(context.surface().selectAll('.' + a.id).node(), {shiftKey: true});
|
||||
var el = context.surface().selectAll('.' + a.id).node();
|
||||
happen.mousedown(el, { shiftKey: true });
|
||||
happen.mouseup(el, { shiftKey: true });
|
||||
expect(context.mode().id).to.eql('browse');
|
||||
});
|
||||
|
||||
specify('shift-click on empty space leaves the selection unchanged', function() {
|
||||
context.enter(iD.modeSelect(context, [a.id]));
|
||||
happen.click(context.surface().node(), {shiftKey: true});
|
||||
var el = context.surface().node();
|
||||
happen.mousedown(el, { shiftKey: true });
|
||||
happen.mouseup(el, { shiftKey: true });
|
||||
expect(context.selectedIDs()).to.eql([a.id]);
|
||||
});
|
||||
});
|
||||
|
||||
+30
-15
@@ -1,25 +1,40 @@
|
||||
describe('iD.uiFlash', function () {
|
||||
var clock;
|
||||
|
||||
var elem;
|
||||
|
||||
beforeEach(function() {
|
||||
elem = d3.select('body').append('div');
|
||||
});
|
||||
|
||||
afterEach(function() { elem.remove(); });
|
||||
|
||||
beforeEach(function () {
|
||||
clock = sinon.useFakeTimers();
|
||||
d3.select('body')
|
||||
.append('div')
|
||||
.attr('id', 'flash-wrap')
|
||||
.append('div')
|
||||
.attr('id', 'footer-wrap');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
clock.restore();
|
||||
d3.select('body > div').remove();
|
||||
});
|
||||
|
||||
it('leaves after 1000 ms', function () {
|
||||
var flash = iD.uiFlash(elem);
|
||||
clock.tick(1610);
|
||||
expect(flash.node().parentNode).to.be.null;
|
||||
it('returns a selection', function () {
|
||||
var content = iD.uiFlash(200);
|
||||
expect(content.size()).to.eql(1);
|
||||
expect(content.classed('content')).to.be.ok;
|
||||
});
|
||||
|
||||
it('flash is shown', function () {
|
||||
iD.uiFlash(200);
|
||||
var flashWrap = d3.selectAll('#flash-wrap');
|
||||
var footerWrap = d3.selectAll('#footer-wrap');
|
||||
expect(flashWrap.classed('footer-show')).to.be.ok;
|
||||
expect(footerWrap.classed('footer-hide')).to.be.ok;
|
||||
});
|
||||
|
||||
it('flash goes away', function (done) {
|
||||
iD.uiFlash(200);
|
||||
window.setTimeout(function() {
|
||||
var flashWrap = d3.selectAll('#flash-wrap');
|
||||
var footerWrap = d3.selectAll('#footer-wrap');
|
||||
expect(flashWrap.classed('footer-hide')).to.be.ok;
|
||||
expect(footerWrap.classed('footer-show')).to.be.ok;
|
||||
done();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
describe('iD.utilSessionMutex', function() {
|
||||
var clock, a, b;
|
||||
|
||||
beforeEach(function () {
|
||||
clock = sinon.useFakeTimers(Date.now());
|
||||
});
|
||||
var a, b;
|
||||
|
||||
afterEach(function() {
|
||||
clock.restore();
|
||||
if (a) a.unlock();
|
||||
if (b) b.unlock();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user