mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Move the edit menu logic to uiInit
Make context the first argument of operation objects Add Paste operation to edit menu when opening the context menu on a blank area of the map (close #2508)
This commit is contained in:
@@ -37,52 +37,52 @@ describe('iD.operationExtract', function () {
|
||||
});
|
||||
|
||||
it('is not available for no selected ids', function () {
|
||||
var result = iD.operationExtract([], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, []).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for two selected ids', function () {
|
||||
var result = iD.operationExtract(['a', 'b'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['a', 'b']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for unknown selected id', function () {
|
||||
var result = iD.operationExtract(['z'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['z']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for selected way', function () {
|
||||
var result = iD.operationExtract(['x'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['x']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for selected node with tags, no parent way', function () {
|
||||
var result = iD.operationExtract(['e'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['e']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for selected node with no tags, no parent way', function () {
|
||||
var result = iD.operationExtract(['f'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['f']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for selected node with no tags, parent way', function () {
|
||||
var result = iD.operationExtract(['c'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['c']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for selected node with no tags, two parent ways', function () {
|
||||
var result = iD.operationExtract(['d'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['d']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is available for selected node with tags, parent way', function () {
|
||||
var result = iD.operationExtract(['a'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['a']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is available for selected node with tags, two parent ways', function () {
|
||||
var result = iD.operationExtract(['b'], fakeContext).available();
|
||||
var result = iD.operationExtract(fakeContext, ['b']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
});
|
||||
@@ -96,7 +96,7 @@ describe('iD.operationExtract', function () {
|
||||
iD.osmNode(createFakeNode('c', false)),
|
||||
iD.osmWay({ id: 'x', nodes: ['a', 'b', 'c'] })
|
||||
]);
|
||||
var result = iD.operationExtract(['b'], fakeContext).disabled();
|
||||
var result = iD.operationExtract(fakeContext, ['b']).disabled();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ describe('iD.operationExtract', function () {
|
||||
iD.osmWay({ id: 'x', nodes: ['a', 'b', 'c'] }),
|
||||
iD.osmRelation({ id: 'r', members: [{ id: 'b', role: 'label' }] })
|
||||
]);
|
||||
var result = iD.operationExtract(['b'], fakeContext).disabled();
|
||||
var result = iD.operationExtract(fakeContext, ['b']).disabled();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('iD.operationExtract', function () {
|
||||
]
|
||||
})
|
||||
]);
|
||||
var result = iD.operationExtract(['d'], fakeContext).disabled();
|
||||
var result = iD.operationExtract(fakeContext, ['d']).disabled();
|
||||
expect(result).to.eql('restriction');
|
||||
});
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('iD.operationExtract', function () {
|
||||
]
|
||||
})
|
||||
]);
|
||||
var result = iD.operationExtract(['d'], fakeContext).disabled();
|
||||
var result = iD.operationExtract(fakeContext, ['d']).disabled();
|
||||
expect(result).to.eql('restriction');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,77 +42,77 @@ describe('iD.operationStraighten', function () {
|
||||
});
|
||||
|
||||
it('is not available for no selected ids', function () {
|
||||
var result = iD.operationStraighten([], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, []).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for way with only 2 nodes', function () {
|
||||
var result = iD.operationStraighten(['w1'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w1']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is available for way with only 2 nodes connected to another 2-node way', function () {
|
||||
var result = iD.operationStraighten(['w1', 'w1-2'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w1', 'w1-2']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is not available for non-continuous ways', function () {
|
||||
var result = iD.operationStraighten(['w2', 'w4'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w2', 'w4']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is available for selected way with more than 2 nodes', function () {
|
||||
var result = iD.operationStraighten(['w2'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w2']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is available for selected, ordered, continuous ways', function () {
|
||||
var result = iD.operationStraighten(['w1', 'w2', 'w3'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w1', 'w2', 'w3']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is available for selected, un-ordered, continuous ways', function () {
|
||||
var result = iD.operationStraighten(['w1', 'w3', 'w2'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w1', 'w3', 'w2']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is available for selected, continuous ways with different way-directions', function () {
|
||||
var result = iD.operationStraighten(['w1', 'w3', 'w2-2'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w1', 'w3', 'w2-2']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is available for 2 selected nodes in the same way, more than one node apart', function () {
|
||||
var result = iD.operationStraighten(['w5', 'n9', 'n11'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w5', 'n9', 'n11']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is available for 2 selected nodes in adjacent ways, more than one node apart', function () {
|
||||
var result = iD.operationStraighten(['w2', 'w3', 'n5', 'n3'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w2', 'w3', 'n5', 'n3']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is available for 2 selected nodes in non-adjacent ways, providing inbetween ways are selected', function () {
|
||||
var result = iD.operationStraighten(['n2', 'n7', 'w4', 'w1', 'w3', 'w2'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['n2', 'n7', 'w4', 'w1', 'w3', 'w2']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is available for 2 selected nodes in non-adjacent, non-same-directional ways, providing inbetween ways are selected', function () {
|
||||
var result = iD.operationStraighten(['n2', 'n7', 'w4', 'w1', 'w3', 'w2-2'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['n2', 'n7', 'w4', 'w1', 'w3', 'w2-2']).available();
|
||||
expect(result).to.be.ok;
|
||||
});
|
||||
|
||||
it('is not available for nodes not on selected ways', function () {
|
||||
var result = iD.operationStraighten(['w5', 'n4', 'n11'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w5', 'n4', 'n11']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for one selected node', function () {
|
||||
var result = iD.operationStraighten(['w5', 'n9'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w5', 'n9']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
|
||||
it('is not available for more than two selected nodes', function () {
|
||||
var result = iD.operationStraighten(['w5', 'n9', 'n11', 'n12'], fakeContext).available();
|
||||
var result = iD.operationStraighten(fakeContext, ['w5', 'n9', 'n11', 'n12']).available();
|
||||
expect(result).to.be.not.ok;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user