This repository has been archived by the owner on May 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(progress-track): Add ghost mode to progress slider
- Loading branch information
1 parent
2d5e061
commit 401c032
Showing
12 changed files
with
242 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const simulatePlaytime = playtime => ({ | ||
type: 'SIMULATE_PLAYTIME', | ||
payload: playtime | ||
}) | ||
|
||
const enableGhostMode = () => ({ | ||
type: 'ENABLE_GHOST_MODE' | ||
}) | ||
|
||
const disableGhostMode = () => ({ | ||
type: 'DISABLE_GHOST_MODE' | ||
}) | ||
|
||
export { | ||
simulatePlaytime, | ||
enableGhostMode, | ||
disableGhostMode | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import test from 'ava' | ||
import { simulatePlaytime, enableGhostMode, disableGhostMode } from './ghost' | ||
|
||
test(`simulatePlaytime: creates the SIMULATE_PLAYTIME action`, t => { | ||
t.deepEqual(simulatePlaytime(100), { | ||
type: 'SIMULATE_PLAYTIME', | ||
payload: 100 | ||
}) | ||
}) | ||
|
||
test(`enableGhostMode: creates the ENABLE_GHOST_MODE action`, t => { | ||
t.deepEqual(enableGhostMode(), { | ||
type: 'ENABLE_GHOST_MODE' | ||
}) | ||
}) | ||
|
||
test(`disableGhostMode: creates the DISABLE_GHOST_MODE action`, t => { | ||
t.deepEqual(disableGhostMode(), { | ||
type: 'DISABLE_GHOST_MODE' | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const INITIAL = { | ||
time: 0, | ||
active: false | ||
} | ||
|
||
const ghost = (state = INITIAL, action) => { | ||
switch (action.type) { | ||
case 'SIMULATE_PLAYTIME': | ||
return { | ||
...state, | ||
time: parseFloat(action.payload) | ||
} | ||
case 'ENABLE_GHOST_MODE': | ||
return { | ||
...state, | ||
active: true | ||
} | ||
case 'DISABLE_GHOST_MODE': | ||
return { | ||
...state, | ||
active: false | ||
} | ||
default: | ||
return state | ||
} | ||
} | ||
|
||
export { | ||
ghost | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import test from 'ava' | ||
import { ghost } from './ghost' | ||
|
||
test(`ghost: it exports a reducer function`, t => { | ||
t.truthy(typeof ghost === 'function') | ||
}) | ||
|
||
test(`ghost: it returns the initial state on default`, t => { | ||
const result = ghost(undefined, { | ||
type: 'FOO' | ||
}) | ||
|
||
t.deepEqual(result, { | ||
time: 0, | ||
active: false | ||
}) | ||
}) | ||
|
||
test(`ghost: it sets the ghost time on SIMULATE_PLAYTIME`, t => { | ||
const result = ghost(undefined, { | ||
type: 'SIMULATE_PLAYTIME', | ||
payload: 100 | ||
}) | ||
|
||
t.deepEqual(result, { | ||
time: 100, | ||
active: false | ||
}) | ||
}) | ||
|
||
test(`ghost: it activates the ghost mode on ENABLE_GHOST_MODE`, t => { | ||
const result = ghost(undefined, { | ||
type: 'ENABLE_GHOST_MODE' | ||
}) | ||
|
||
t.deepEqual(result, { | ||
time: 0, | ||
active: true | ||
}) | ||
}) | ||
|
||
test(`ghost: it disables the ghost mode on DISABLE_GHOST_MODE`, t => { | ||
const result = ghost(undefined, { | ||
type: 'DISABLE_GHOST_MODE' | ||
}) | ||
|
||
t.deepEqual(result, { | ||
time: 0, | ||
active: false | ||
}) | ||
}) | ||
|
||
// test(`error: it sets the message and title on ERROR_LOAD`, t => { | ||
// const result = error(undefined, { | ||
// type: 'ERROR_LOAD' | ||
// }) | ||
|
||
// t.deepEqual(result, { | ||
// title: 'ERROR.LOADING.TITLE', | ||
// message: 'ERROR.LOADING.MESSAGE' | ||
// }) | ||
// }) | ||
|
||
// test(`error: it sets the message and title on ERROR_MISSING_AUDIO_FILES`, t => { | ||
// const result = error(undefined, { | ||
// type: 'ERROR_MISSING_AUDIO_FILES' | ||
// }) | ||
|
||
// t.deepEqual(result, { | ||
// title: 'ERROR.MISSING_FILES.TITLE', | ||
// message: 'ERROR.MISSING_FILES.MESSAGE' | ||
// }) | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.