[major] choo v4 (#352)

* location: change url on location:setLocation

- [ ] don't break hashing
- [ ] allow not changing the url

fixup! move fns around

fixup! add search string

* app.start: clean

* walk: add

* location: update arg calls

* fixup! location: update

* uri-wrap: fix thunking

* router: update to latest sheet-router (#239)

* router: update to latest sheet-router

* tests: fix for latest version

* tests: fix SSR

* tests: fix history

* tests: spruce up

* docs: update example

* examples: update

* deps: bump sheet-router

* 4.0.0-0

* chore(changelog): 4.0.0 (#211)

* feat(api:) arg order (#268)

* s/data, state/state, data/

* feat(api): swap arguments

* fix(href): fix routing (#271)

* feat(http): remove (#269)

* feat(router): enable hash routing (#273)

* deps: fix mount

* 4.0.0-1

* feat(mount): copy {script,link} tags

* 4.0.0-2

* fix(mount): forEach -> for

Lol can't use forEach

* fix(router): use state.location.href (#282)

* fix(mount): use deep node clone

* 4.0.0-3

* fix(deps): remove hash-match

* 4.0.0-4

* fix(mount): return node

* 4.0.0-5

* fix(router): check if a hash is a valid selector (#339)

* 4.0.0-6

* fix(router): pass params on newstate (#343)

* 4.0.0-7

* feat(docs): update for 4.0.0 (#320)

* feat(docs): update for 4.0.0

* docs: update router example in readme (#337)

* chore(changelog): update for v4 (#351)
This commit is contained in:
Yoshua Wuyts
2016-12-11 19:35:29 +01:00
committed by GitHub
parent 54b6000800
commit a7916ec3f9
30 changed files with 569 additions and 503 deletions
+13 -15
View File
@@ -10,15 +10,15 @@ test('hooks', function (t) {
onError: function (err) {
t.equal(err.message, 'effect error', 'onError: receives err')
},
onAction: function (data, state, name, caller, createSend) {
onAction: function (state, data, name, caller, createSend) {
if (name === 'explodes') return
t.deepEqual(data, {foo: 'bar'}, 'onAction: action data')
t.equal(state.clicks, 0, 'onAction: current state: 0 clicks')
t.equal(name, 'click', 'onAction: action name')
t.equal(name, 'click', 'onAction: data name')
t.equal(caller, 'view: /', 'onAction: caller name')
t.equal(typeof createSend, 'function', 'onAction: createSend fn')
},
onStateChange: function (data, state, prev, createSend) {
onStateChange: function (state, data, prev, createSend) {
t.deepEqual(data, {foo: 'bar'}, 'onState: action data')
t.deepEqual(state.clicks, 1, 'onState: new state: 1 clicks')
t.deepEqual(prev.clicks, 0, 'onState: prev state: 0 clicks')
@@ -30,26 +30,24 @@ test('hooks', function (t) {
clicks: 0
},
reducers: {
click: (data, state) => ({clicks: state.clicks + 1})
click: (state, data) => ({clicks: state.clicks + 1})
},
effects: {
explodes: (data, state, send, done) => {
explodes: (state, data, send, done) => {
setTimeout(() => done(new Error('effect error')), 5)
}
}
})
var sent = false
app.router((route) => [
route('/', function (state, prev, send) {
if (!sent) {
send('click', {foo: 'bar'})
send('explodes')
}
sent = true
return view`<span></span>`
})
])
app.router(['/', function (state, prev, send) {
if (!sent) {
send('click', {foo: 'bar'})
send('explodes')
}
sent = true
return view`<span></span>`
}])
const tree = app.start()
t.on('end', append(tree))