Skip to content

Commit

Permalink
$interpolate: coverage + cast to string on single token
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 23, 2015
1 parent b70bffe commit 6858f5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ exports.$interpolate = function (text) {
var vm = this
if (tokens) {
if (tokens.length === 1) {
return vm.$eval(tokens[0].value)
return vm.$eval(tokens[0].value) + ''
} else {
return tokens.map(function (token) {
return token.tag
Expand Down
1 change: 1 addition & 0 deletions test/unit/specs/api/data_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ describe('Data API', function () {

it('$interpolate', function () {
expect(vm.$interpolate('abc')).toBe('abc')
expect(vm.$interpolate('{{a}}')).toBe('1')
expect(vm.$interpolate('{{a}} and {{a + b.c | double}}')).toBe('1 and 6')
})

Expand Down

0 comments on commit 6858f5c

Please sign in to comment.