Skip to content

Commit

Permalink
When checking if a tag is present, check on the split array of tags, …
Browse files Browse the repository at this point in the history
…not the raw string.
  • Loading branch information
davidmcclure committed Sep 23, 2014
1 parent b2bf185 commit 5a5de87
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tests/jasmine/tests/neatline/record/HasTag.spec.js
Expand Up @@ -53,4 +53,17 @@ describe('Record | Has Tag', function() {
});


it('substring tags', function() {

var record = new Neatline.Shared.Record.Model({
tags: 'tag1, tag2'
});

expect(record.hasTag('tag1')).toBeTruthy();
expect(record.hasTag('tag2')).toBeTruthy();
expect(record.hasTag('tag')).toBeFalsy();

});


});
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion views/shared/javascripts/src/shared/record/record.model.js
Expand Up @@ -122,7 +122,7 @@ Neatline.module('Shared.Record', function(Record) {
* @return {Boolean}
*/
hasTag: function(tag) {
return _.contains(this.get('tags'), tag);
return _.contains(this.splitTags(), tag);
},


Expand Down

0 comments on commit 5a5de87

Please sign in to comment.