Skip to content

Commit 6858f5c

Browse files
committed
$interpolate: coverage + cast to string on single token
1 parent b70bffe commit 6858f5c

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
@@ -121,7 +121,7 @@ exports.$interpolate = function (text) {
121121
var vm = this
122122
if (tokens) {
123123
if (tokens.length === 1) {
124-
return vm.$eval(tokens[0].value)
124+
return vm.$eval(tokens[0].value) + ''
125125
} else {
126126
return tokens.map(function (token) {
127127
return token.tag

test/unit/specs/api/data_spec.js

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

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy