Skip to content

Commit 4e75f04

Browse files
committed
$interpolate: coverage + cast to string on single token
1 parent 57742c3 commit 4e75f04

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
@@ -133,7 +133,7 @@ exports.$interpolate = function (text) {
133133
var vm = this
134134
if (tokens) {
135135
if (tokens.length === 1) {
136-
return vm.$eval(tokens[0].value)
136+
return vm.$eval(tokens[0].value) + ''
137137
} else {
138138
return tokens.map(function (token) {
139139
return token.tag

test/unit/specs/api/data_spec.js

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

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

0 commit comments

Comments
 (0)