Skip to content

Commit

Permalink
Merge pull request esbanarango#1 from earayo/bugfix_types
Browse files Browse the repository at this point in the history
Bugfix types
  • Loading branch information
Edward Alejandro Rayo Cortes authored Jun 21, 2016
2 parents 41309b9 + 4b26f34 commit 3356e18
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
8 changes: 6 additions & 2 deletions addon/components/place-autocomplete-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ export default Component.extend({
},

_typesToArray() {
return this.get('types').split();
if (this.get('types') !== "") {
return this.get('types').split(',');
} else {
return [];
}
},

actions: {
focusOut() {
this._callCallback('focusOutCallback');
}
}
});
});
16 changes: 15 additions & 1 deletion tests/unit/components/place-autocomplete-field-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,19 @@ describeComponent(
component.set('types', 'geocode');
expect(component._typesToArray()).to.eql(['geocode']);
});

it('converts types option to array more two elements', function(){
var component = this.subject();
component.set('types', 'geocode,establishment');
expect(component._typesToArray()).to.eql(['geocode','establishment']);
});

it('converts types in an empty string', function(){
var component = this.subject();
component.set('types', '');
expect(component._typesToArray()).to.eql([]);
});


}
);
);

0 comments on commit 3356e18

Please sign in to comment.