Files
iD/test/spec/actions/change_preset.js
T
Bryan Housel 71b2d2c6b7 Upgrade legacy symbols in tests
- iD.Context -> iD.coreContext
- iD.Graph -> iD.coreGraph
- iD.Node -> iD.osmNode
- iD.Way -> iD.osmWay
- iD.Relation -> iD.osmRelation
2019-01-30 15:43:02 -05:00

26 lines
1.2 KiB
JavaScript

describe('iD.actionChangePreset', function() {
var oldPreset = iD.presetPreset('old', {tags: {old: 'true'}}),
newPreset = iD.presetPreset('new', {tags: {new: 'true'}});
it('changes from one preset\'s tags to another\'s', function() {
var entity = iD.osmNode({tags: {old: 'true'}}),
graph = iD.coreGraph([entity]),
action = iD.actionChangePreset(entity.id, oldPreset, newPreset);
expect(action(graph).entity(entity.id).tags).to.eql({new: 'true'});
});
it('adds the tags of a new preset to an entity without an old preset', function() {
var entity = iD.osmNode(),
graph = iD.coreGraph([entity]),
action = iD.actionChangePreset(entity.id, null, newPreset);
expect(action(graph).entity(entity.id).tags).to.eql({new: 'true'});
});
it('removes the tags of an old preset from an entity without a new preset', function() {
var entity = iD.osmNode({tags: {old: 'true'}}),
graph = iD.coreGraph([entity]),
action = iD.actionChangePreset(entity.id, oldPreset, null);
expect(action(graph).entity(entity.id).tags).to.eql({});
});
});