Skip to content

Commit 92a62e8

Browse files
committed
$interpolate: coverage + cast to string on single token
1 parent ab9654b commit 92a62e8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/api/data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ exports.$interpolate = function (text) {
119119
var vm = this
120120
if (tokens) {
121121
if (tokens.length === 1) {
122-
return vm.$eval(tokens[0].value)
122+
return vm.$eval(tokens[0].value) + ''
123123
} else {
124124
return tokens.map(function (token) {
125125
return token.tag

test/unit/specs/api/data_spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ describe('Data API', function () {
145145

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

0 commit comments

Comments
 (0)