Don't enter iD.modeSelect without valid entities in selectedIDs

This commit is contained in:
Bryan Housel
2016-12-09 11:32:14 -05:00
parent a3de3534c3
commit 8a66b3d892
3 changed files with 39 additions and 5 deletions
+12
View File
@@ -31,6 +31,18 @@ describe('iD.behaviorSelect', function() {
container.remove();
});
specify('refuse to enter select mode with no ids', function() {
context.enter(iD.modeSelect(context, []));
expect(context.mode().id, 'empty array').to.eql('browse');
context.enter(iD.modeSelect(context, undefined));
expect(context.mode().id, 'undefined').to.eql('browse');
});
specify('refuse to enter select mode with nonexistent ids', function() {
context.enter(iD.modeSelect(context, ['w-1']));
expect(context.mode().id).to.eql('browse');
});
specify('click on entity selects the entity', function() {
happen.click(context.surface().selectAll('.' + a.id).node());
expect(context.selectedIDs()).to.eql([a.id]);