Skip to content

Commit 44f7a6d

Browse files
committed
test for Path.set on Array
1 parent d33bbd2 commit 44f7a6d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/unit/specs/parsers/path_spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ describe('Path Parser', function () {
136136
expect(parent.a.b.c).toBe(123)
137137
})
138138

139+
it('set array', function () {
140+
var target = {
141+
a: []
142+
}
143+
target.a.$set = jasmine.createSpy('Array.$set')
144+
var res = Path.set(target, 'a[1]', 123)
145+
expect(res).toBe(true)
146+
expect(target.a.$set).toHaveBeenCalledWith('1', 123)
147+
})
148+
139149
it('set invalid', function () {
140150
var res = Path.set({}, 'ab[c]d', 123)
141151
expect(res).toBe(false)

0 commit comments

Comments
 (0)