mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-25 06:55:46 +00:00
26 lines
1.1 KiB
JavaScript
26 lines
1.1 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.Node({tags: {old: 'true'}}),
|
|
graph = iD.Graph([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.Node(),
|
|
graph = iD.Graph([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.Node({tags: {old: 'true'}}),
|
|
graph = iD.Graph([entity]),
|
|
action = iD.actionChangePreset(entity.id, oldPreset, null);
|
|
expect(action(graph).entity(entity.id).tags).to.eql({});
|
|
});
|
|
});
|