-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Themes: Removes all the remaining traces of Flux stores
* `reducers/themes-last-query`: Remove Flux dispatcher `waitFor` * `reducers/themes-list`: Use `isJetpack()` from selectors instead of `ThemeLastQueryStore`'s * Kill `shared/lib/themes/stores` * Remove obsolete helper functions from reducers, now that they are in `selectors/` * Default-export reducers, don't export initialStates anymore * Update README.md * Rewrite tests in `shared/lib/themes` to directly test reducers instead of stores Note that in test/themes-list-store, the Jetpack test is removed since filtering is no longer done in the reducer but in the themes-list-fetcher data component (using the getFilteredThemes()) now.
- Loading branch information
Showing
16 changed files
with
273 additions
and
374 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
import { expect } from 'chai'; | ||
|
||
import { createStore } from 'redux'; | ||
|
||
import ThemeConstants from '../constants'; | ||
import reducer from '../reducers/current-theme'; | ||
|
||
describe( 'current-theme', () => { | ||
const SITE = { ID: 77203074 }; // dummy id | ||
|
||
const actionReceiveCurrentTheme = { | ||
type: ThemeConstants.RECEIVE_CURRENT_THEME, | ||
themeId: 'twentyfifteen', | ||
themeName: 'Twenty Fifteen', | ||
site: SITE | ||
}; | ||
|
||
let store; | ||
|
||
function getCurrentTheme( siteId ) { | ||
return store.getState().get( 'currentThemes' ).get( siteId ); | ||
} | ||
|
||
beforeEach( () => { | ||
store = createStore( reducer ); | ||
} ); | ||
|
||
describe( 'get()', () => { | ||
beforeEach( () => { | ||
store.dispatch( actionReceiveCurrentTheme ); | ||
} ); | ||
|
||
it( 'returns the current theme for the supplied site id', () => { | ||
const currentTheme = getCurrentTheme( SITE.ID ); | ||
|
||
expect( currentTheme.id ).to.equal( 'twentyfifteen' ); | ||
expect( currentTheme.name ).to.equal( 'Twenty Fifteen' ); | ||
} ); | ||
} ); | ||
} ); |
Oops, something went wrong.