Skip to content

Commit

Permalink
Fix startWith, endWith, append, and prepend methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Bassett committed Jan 26, 2019
1 parent a4f3d7c commit 4aad28c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* Fix issue with array arguments passed to `startWith`, `endWith`, `append`, and `prepend` methods

## 3.0.1 (2019-01-26)

* Add `Signal#startWith` and `Signal#endWith` methods
Expand Down
6 changes: 3 additions & 3 deletions packages/bulb/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/bulb/src/Signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ export default class Signal {
as = as[0]
}

return concat(this, Signal.fromArray(as))
return concat([this, Signal.fromArray(as)])
}

/**
Expand Down Expand Up @@ -801,7 +801,7 @@ export default class Signal {
* t.subscribe(console.log) // 1, 2, 3, 4
*/
endWith (a) {
return concat(this, Signal.of(a))
return concat([this, Signal.of(a)])
}

/**
Expand Down Expand Up @@ -965,7 +965,7 @@ export default class Signal {
as = as[0]
}

return concat(Signal.fromArray(as), this)
return concat([Signal.fromArray(as), this])
}

/**
Expand Down Expand Up @@ -1044,7 +1044,7 @@ export default class Signal {
* t.subscribe(console.log) // 0, 1, 2, 3
*/
startWith (a) {
return concat(Signal.of(a), this)
return concat([Signal.of(a), this])
}

/**
Expand Down
12 changes: 6 additions & 6 deletions packages/bulb/src/Signal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,13 @@ describe('Signal', () => {

it('handles an array', () => {
s.append([1, 2, 3])
expect(concat).toHaveBeenCalledWith(s, t)
expect(concat).toHaveBeenCalledWith([s, t])
expect(spy).toHaveBeenCalledWith([1, 2, 3])
})

it('handles multiple arguments', () => {
s.append(1, 2, 3)
expect(concat).toHaveBeenCalledWith(s, t)
expect(concat).toHaveBeenCalledWith([s, t])
expect(spy).toHaveBeenCalledWith([1, 2, 3])
})
})
Expand Down Expand Up @@ -345,7 +345,7 @@ describe('Signal', () => {
it('appends the given value', () => {
s.endWith(1)
expect(spy).toHaveBeenCalledWith(1)
expect(concat).toHaveBeenCalledWith(s, t)
expect(concat).toHaveBeenCalledWith([s, t])
})
})

Expand Down Expand Up @@ -404,13 +404,13 @@ describe('Signal', () => {
it('handles an array', () => {
s.prepend([1, 2, 3])
expect(spy).toHaveBeenCalledWith([1, 2, 3])
expect(concat).toHaveBeenCalledWith(t, s)
expect(concat).toHaveBeenCalledWith([t, s])
})

it('handles multiple arguments', () => {
s.prepend(1, 2, 3)
expect(spy).toHaveBeenCalledWith([1, 2, 3])
expect(concat).toHaveBeenCalledWith(t, s)
expect(concat).toHaveBeenCalledWith([t, s])
})
})

Expand All @@ -430,7 +430,7 @@ describe('Signal', () => {
it('prepends the given value', () => {
s.startWith(1)
expect(spy).toHaveBeenCalledWith(1)
expect(concat).toHaveBeenCalledWith(t, s)
expect(concat).toHaveBeenCalledWith([t, s])
})
})

Expand Down

0 comments on commit 4aad28c

Please sign in to comment.