diff --git a/shared/lib/themes/README.md b/shared/lib/themes/README.md index 3bb286ecf87f4..f35da833dcf77 100644 --- a/shared/lib/themes/README.md +++ b/shared/lib/themes/README.md @@ -1,11 +1,9 @@ Theme Data ========== -Contains stores and action creators for themes, and the theme showcase. +Contains reducers and action creators for themes, and the theme showcase. -## Stores - -We're transitioning to a more `redux`-like architecture, so our Flux `./stores` are created from `./reducers`, using our own `createReducerStore()`. +## Reducers ### current-theme diff --git a/shared/lib/themes/reducers/current-theme.js b/shared/lib/themes/reducers/current-theme.js index 21a3393798ee6..f55dae2cfb087 100644 --- a/shared/lib/themes/reducers/current-theme.js +++ b/shared/lib/themes/reducers/current-theme.js @@ -8,13 +8,13 @@ import { fromJS } from 'immutable'; */ import ThemeConstants from 'lib/themes/constants'; -export const initialState = fromJS( { +const initialState = fromJS( { isActivating: false, hasActivated: false, currentThemes: {} } ); -export const reducer = ( state = initialState, action ) => { +export default ( state = initialState, action ) => { switch ( action.type ) { case ThemeConstants.RECEIVE_CURRENT_THEME: return state.setIn( [ 'currentThemes', action.site.ID ], { @@ -33,7 +33,3 @@ export const reducer = ( state = initialState, action ) => { } return state; }; - -export function getCurrentTheme( state, siteId ) { - return state.get( 'currentThemes' ).get( siteId ); -} diff --git a/shared/lib/themes/reducers/index.js b/shared/lib/themes/reducers/index.js index 317e3ab0b8a4a..0eb11a92eff2c 100644 --- a/shared/lib/themes/reducers/index.js +++ b/shared/lib/themes/reducers/index.js @@ -6,10 +6,10 @@ import { combineReducers } from 'redux'; /** * Internal dependencies */ -import { reducer as themes } from './themes'; -import { reducer as themesList } from './themes-list'; -import { reducer as themesLastQuery } from './themes-last-query'; -import { reducer as currentTheme } from './current-theme'; +import themes from './themes'; +import themesList from './themes-list'; +import themesLastQuery from './themes-last-query'; +import currentTheme from './current-theme'; export default combineReducers( { themes, diff --git a/shared/lib/themes/reducers/themes-last-query.js b/shared/lib/themes/reducers/themes-last-query.js index 4337115085194..e886558f0d05c 100644 --- a/shared/lib/themes/reducers/themes-last-query.js +++ b/shared/lib/themes/reducers/themes-last-query.js @@ -8,14 +8,14 @@ import { fromJS } from 'immutable'; */ import ThemeConstants from '../constants'; -export const initialState = fromJS( { +const initialState = fromJS( { previousSiteId: 0, currentSiteId: null, isJetpack: null, lastParams: null, } ); -export const reducer = ( state = initialState, action ) => { +export default ( state = initialState, action ) => { switch ( action.type ) { case ThemeConstants.QUERY_THEMES: return state.set( 'lastParams', action.params ); @@ -29,11 +29,3 @@ export const reducer = ( state = initialState, action ) => { return state; }; - -export function hasSiteChanged( state ) { - return state.get( 'previousSiteId' ) !== state.get( 'currentSiteId' ); -}; - -export function hasParams( state ) { - return !! state.get( 'lastParams' ); -} diff --git a/shared/lib/themes/reducers/themes-list.js b/shared/lib/themes/reducers/themes-list.js index 35ebd6097f1fb..0860790e04387 100644 --- a/shared/lib/themes/reducers/themes-list.js +++ b/shared/lib/themes/reducers/themes-list.js @@ -21,7 +21,7 @@ const defaultQueryState = fromJS( { isFetchingNextPage: false } ); -export const initialState = query( fromJS( { +const initialState = query( fromJS( { list: [], nextId: 0, query: {}, @@ -54,7 +54,7 @@ function isActionForLastPage( list, action ) { action.themes.length === 0; } -export const reducer = ( state = initialState, action ) => { +export default ( state = initialState, action ) => { switch ( action.type ) { case ThemeConstants.QUERY_THEMES: return query( state, action.params ); diff --git a/shared/lib/themes/reducers/themes.js b/shared/lib/themes/reducers/themes.js index 88ff0d4025130..091df1d4843f2 100644 --- a/shared/lib/themes/reducers/themes.js +++ b/shared/lib/themes/reducers/themes.js @@ -9,7 +9,7 @@ import transform from 'lodash/object/transform'; */ import ThemeConstants from 'lib/themes/constants'; -export const initialState = fromJS( { +const initialState = fromJS( { themes: {}, currentSiteId: 0 } ); @@ -26,7 +26,7 @@ function setActiveTheme( themeId, themes ) { .setIn( [ themeId, 'active' ], true ); } -export const reducer = ( state = initialState, action ) => { +export default( state = initialState, action ) => { switch ( action.type ) { case ThemeConstants.RECEIVE_THEMES: const isNewSite = action.isJetpack && ( action.siteId !== state.get( 'currentSiteId' ) ); @@ -40,8 +40,3 @@ export const reducer = ( state = initialState, action ) => { } return state; }; - -export function getThemeById( state, id ) { - const theme = state.getIn( [ 'themes', id ] ); - return theme ? theme.toJS() : undefined; -} diff --git a/shared/lib/themes/stores/current-theme.js b/shared/lib/themes/stores/current-theme.js deleted file mode 100644 index 9f5df4bf325a9..0000000000000 --- a/shared/lib/themes/stores/current-theme.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Internal dependencies - */ -import { createReducerStore } from 'lib/store'; -import { reducer, initialState, getCurrentTheme } from '../reducers/current-theme'; - -const CurrentThemeStore = createReducerStore( reducer, initialState ); - -CurrentThemeStore.getCurrentTheme = ( siteId ) => getCurrentTheme( CurrentThemeStore.get(), siteId ); -CurrentThemeStore.isActivating = () => CurrentThemeStore.get().get( 'isActivating' ); -CurrentThemeStore.hasActivated = () => CurrentThemeStore.get().get( 'hasActivated' ); - -export default CurrentThemeStore; - diff --git a/shared/lib/themes/stores/themes-last-query.js b/shared/lib/themes/stores/themes-last-query.js deleted file mode 100644 index ce6998792f162..0000000000000 --- a/shared/lib/themes/stores/themes-last-query.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Internal dependencies - */ -import { createReducerStore } from 'lib/store'; -import { reducer, initialState, hasSiteChanged, hasParams } from '../reducers/themes-last-query'; - -const LastQueryStore = createReducerStore( reducer, initialState ); - -LastQueryStore.getSiteId = () => LastQueryStore.get().get( 'currentSiteId' ); -LastQueryStore.hasSiteChanged = () => hasSiteChanged( LastQueryStore.get() ); -LastQueryStore.hasParams = () => hasParams( LastQueryStore.get() ); -LastQueryStore.getParams = () => LastQueryStore.get().get( 'lastParams' ) || {}; -LastQueryStore.isJetpack = () => LastQueryStore.get().get( 'isJetpack' ); - -export default LastQueryStore; diff --git a/shared/lib/themes/stores/themes-list.js b/shared/lib/themes/stores/themes-list.js deleted file mode 100644 index c87a7f96fd807..0000000000000 --- a/shared/lib/themes/stores/themes-list.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Internal dependencies - */ -import { createReducerStore } from 'lib/store'; -import ThemesLastQueryStore from './themes-last-query'; -import { reducer, initialState, getQueryParams } from '../reducers/themes-list'; - -const ThemesListStore = createReducerStore( reducer, initialState ); - -ThemesListStore.getThemesList = () => ThemesListStore.get().get( 'list' ); -ThemesListStore.getQueryParams = () => getQueryParams( ThemesListStore.get() ); -ThemesListStore.isLastPage = () => ThemesLastQueryStore.isJetpack() || ThemesListStore.get().getIn( [ 'queryState', 'isLastPage' ] ); -ThemesListStore.isFetchingNextPage = () => ThemesListStore.get().getIn( [ 'queryState', 'isFetchingNextPage' ] ); - -export default ThemesListStore; diff --git a/shared/lib/themes/stores/themes.js b/shared/lib/themes/stores/themes.js deleted file mode 100644 index 3e25c3312fd63..0000000000000 --- a/shared/lib/themes/stores/themes.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Internal dependencies - */ -import { createReducerStore } from 'lib/store'; -import { reducer, initialState, getThemeById } from '../reducers/themes'; - -const ThemesStore = createReducerStore( reducer, initialState ); - -ThemesStore.getThemes = () => ThemesStore.get().get( 'themes' ).toJS(); -ThemesStore.getById = ( id ) => getThemeById( ThemesStore.get(), id ); - -export default ThemesStore; diff --git a/shared/lib/themes/test/current-theme-store.js b/shared/lib/themes/test/current-theme-store.js deleted file mode 100644 index 3d85fa41e86e3..0000000000000 --- a/shared/lib/themes/test/current-theme-store.js +++ /dev/null @@ -1,38 +0,0 @@ -require( 'lib/react-test-env-setup' )(); - -var expect = require( 'chai' ).expect, - rewire = require( 'rewire' ); - -var ThemeConstants = require( 'lib/themes/constants' ); - -describe( 'CurrentThemeStore', function() { - var SITE = { ID: 77203074 }; // dummy id - - var CurrentThemeStore, registeredCallback, - actionReceiveCurrentTheme = { - action: { - type: ThemeConstants.RECEIVE_CURRENT_THEME, - themeId: 'twentyfifteen', - themeName: 'Twenty Fifteen', - site: SITE - } - }; - - beforeEach( function() { - CurrentThemeStore = rewire( 'lib/themes/current-theme-store' ); - registeredCallback = CurrentThemeStore.__get__( 'registeredCallback' ); - } ); - - describe( 'get()', function() { - beforeEach( function() { - registeredCallback( actionReceiveCurrentTheme ); - } ); - - it( 'returns the current theme for the supplied site id', function() { - var currentTheme = CurrentThemeStore.getCurrentTheme( SITE.ID ); - - expect( currentTheme.id ).to.equal( 'twentyfifteen' ); - expect( currentTheme.name ).to.equal( 'Twenty Fifteen' ); - } ); - } ); -} ); diff --git a/shared/lib/themes/test/current-theme.js b/shared/lib/themes/test/current-theme.js new file mode 100644 index 0000000000000..ecd821e9e6cd1 --- /dev/null +++ b/shared/lib/themes/test/current-theme.js @@ -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' ); + } ); + } ); +} ); diff --git a/shared/lib/themes/test/themes-list-store.js b/shared/lib/themes/test/themes-list-store.js deleted file mode 100644 index 779cb5f864ced..0000000000000 --- a/shared/lib/themes/test/themes-list-store.js +++ /dev/null @@ -1,173 +0,0 @@ -var assert = require( 'chai' ).assert, - sinon = require( 'sinon' ), - rewire = require( 'rewire' ); - -var ThemeConstants = require( 'lib/themes/constants' ); - -describe( 'ThemesListStore', function() { - var ThemesListStore, registeredCallback, - actionReceiveThemes = { - action: { - type: ThemeConstants.RECEIVE_THEMES, - queryParams: { - id: 1 - }, - themes: [ - { id: 'bold-news', name: 'Bold News' }, - { id: 'picard', name: 'Picard' }, - { id: 'picard', name: 'Picard' } - ] - }, - }, - actionReceiveMoreThemes = { - action: { - type: ThemeConstants.RECEIVE_THEMES, - queryParams: { - id: 1 - }, - themes: [ - { id: 'picard', name: 'Picard' }, - { id: 'hue', name: 'Hue' } - ] - } - }, - actionReceiveEvenMoreThemes = { - action: { - type: ThemeConstants.RECEIVE_THEMES, - queryParams: { - id: 2 - }, - themes: [ - { id: '2014', name: 'Twenty Fourteen' }, - { id: 'cheese', name: 'Cheese' } - ] - } - }, - actionQueryThemes = { - action: { - type: ThemeConstants.QUERY_THEMES, - params: { - search: 'picard', - perPage: 50, - page: 25 - } - } - }, - actionQueryAnotherTheme = { - action: { - type: ThemeConstants.QUERY_THEMES, - params: { - search: 'worf', - perPage: 50, - page: 25 - } - } - }, - actionIncrementPage = { - action: { - type: ThemeConstants.INCREMENT_THEMES_PAGE - } - }; - - beforeEach( function() { - ThemesListStore = rewire( 'lib/themes/themes-list-store' ); - registeredCallback = ThemesListStore.__get__( 'registeredCallback' ); - ThemesListStore.__set__( 'Dispatcher', { waitFor: sinon.stub() } ); - } ); - - describe( 'get()', function() { - beforeEach( function() { - registeredCallback( actionQueryThemes ); - registeredCallback( actionReceiveThemes ); - } ); - - it( 'returns all themes', function() { - var themes = ThemesListStore.get(); - - assert( themes.length === 2, 'Wrong number of themes' ); - } ); - } ); - - describe( 'query()', function() { - beforeEach( function() { - registeredCallback( actionQueryThemes ); - } ); - - it( 'sets the query paramaters', function() { - var params = ThemesListStore.getQueryParams(); - - assert( params.search === 'picard', 'Wrong param' ); - assert( params.perPage === 50, 'Wrong param' ); - assert( params.page === 25, 'Wrong param' ); - } ); - } ); - - describe( 'getQueryParams()', function() { - context( 'when THEMES_INCREMENT_PAGE is received', function() { - beforeEach( function() { - registeredCallback( actionIncrementPage ); - } ); - - it( 'increments the page number', function() { - var params = ThemesListStore.getQueryParams(); - - assert( params.page === 1 ); - } ); - } ); - } ); - - context( 'when THEMES_RECEIVE is received', function() { - beforeEach( function() { - registeredCallback( actionQueryThemes ); - registeredCallback( actionReceiveThemes ); - } ); - - it( 'removes duplicates', function() { - registeredCallback( actionReceiveMoreThemes ); - - assert( ThemesListStore.get().length === 3, 'incorrect number of themes' ); - } ); - } ); - - context( 'when two THEMES_RECEIVE are received out of order', () => { - beforeEach( () => { - registeredCallback( actionQueryThemes ); // first query, query ID of 1 - registeredCallback( actionQueryAnotherTheme ); // second query, ID 2 - registeredCallback( actionReceiveEvenMoreThemes ); // receive themes from second query (ID 2) - registeredCallback( actionReceiveThemes ); // receive themes from first query (ID 1) - } ); - - it( 'only takes into account the last query results', () => { - assert( ThemesListStore.get().length === 2 ); - assert( ThemesListStore.get()[0] === '2014' ); - } ); - } ); - - context( 'when on a Jetpack site', function() { - context( 'when THEMES_RECEIVE is received', function() { - let rewireRevert; - - beforeEach( function() { - rewireRevert = ThemesListStore.__set__( { - ThemesLastQueryStore: { - isJetpack: () => true, - getParams: () => ( { search: 'picard' } ), - }, - ThemesStore: { - get: () => actionReceiveMoreThemes.action.themes, - } - } ); - } ); - - it( 'filters available themes according to search', function() { - registeredCallback( actionReceiveMoreThemes ); - assert.equal( ThemesListStore.get().length, 1 ); - assert.equal( ThemesListStore.get()[0], 'picard' ); - } ); - - afterEach( function() { - rewireRevert(); - } ); - } ); - } ); -} ); diff --git a/shared/lib/themes/test/themes-list.js b/shared/lib/themes/test/themes-list.js new file mode 100644 index 0000000000000..c891c5cfe82fc --- /dev/null +++ b/shared/lib/themes/test/themes-list.js @@ -0,0 +1,145 @@ +import { assert } from 'chai'; + +import { createStore } from 'redux'; + +import ThemeConstants from '../constants'; +import reducer from '../reducers/themes-list'; + +describe( 'themes-list', () => { + const actionReceiveThemes = { + type: ThemeConstants.RECEIVE_THEMES, + queryParams: { + id: 1 + }, + themes: [ + { id: 'bold-news', name: 'Bold News' }, + { id: 'picard', name: 'Picard' }, + { id: 'picard', name: 'Picard' } + ] + }; + + const actionReceiveMoreThemes = { + type: ThemeConstants.RECEIVE_THEMES, + queryParams: { + id: 1 + }, + themes: [ + { id: 'picard', name: 'Picard' }, + { id: 'hue', name: 'Hue' } + ] + }; + + const actionReceiveEvenMoreThemes = { + type: ThemeConstants.RECEIVE_THEMES, + queryParams: { + id: 2 + }, + themes: [ + { id: '2014', name: 'Twenty Fourteen' }, + { id: 'cheese', name: 'Cheese' } + ] + }; + + const actionQueryThemes = { + type: ThemeConstants.QUERY_THEMES, + params: { + search: 'picard', + perPage: 50, + page: 25 + } + }; + + const actionQueryAnotherTheme = { + type: ThemeConstants.QUERY_THEMES, + params: { + search: 'worf', + perPage: 50, + page: 25 + } + }; + + const actionIncrementPage = { + type: ThemeConstants.INCREMENT_THEMES_PAGE + }; + + let store; + + function getThemesList() { + return store.getState().get( 'list' ); + } + + function getQueryParams() { + return store.getState().get( 'query' ).toObject(); + } + + beforeEach( () => { + store = createStore( reducer ); + } ); + + describe( 'get()', () => { + beforeEach( () => { + store.dispatch( actionQueryThemes ); + store.dispatch( actionReceiveThemes ); + } ); + + it( 'returns all themes', () => { + const themes = getThemesList(); + assert( themes.length === 2, 'Wrong number of themes' ); + } ); + } ); + + describe( 'query()', () => { + beforeEach( () => { + store.dispatch( actionQueryThemes ); + } ); + + it( 'sets the query paramaters', () => { + var params = getQueryParams(); + + assert( params.search === 'picard', 'Wrong param' ); + assert( params.perPage === 50, 'Wrong param' ); + assert( params.page === 25, 'Wrong param' ); + } ); + } ); + + describe( 'getQueryParams()', () => { + context( 'when THEMES_INCREMENT_PAGE is received', () => { + beforeEach( () => { + store.dispatch( actionIncrementPage ); + } ); + + it( 'increments the page number', () => { + var params = getQueryParams(); + + assert( params.page === 1 ); + } ); + } ); + } ); + + context( 'when THEMES_RECEIVE is received', () => { + beforeEach( () => { + store.dispatch( actionQueryThemes ); + store.dispatch( actionReceiveThemes ); + } ); + + it( 'removes duplicates', () => { + store.dispatch( actionReceiveMoreThemes ); + + assert( getThemesList().length === 3, 'incorrect number of themes' ); + } ); + } ); + + context( 'when two THEMES_RECEIVE are received out of order', () => { + beforeEach( () => { + store.dispatch( actionQueryThemes ); // first query, query ID of 1 + store.dispatch( actionQueryAnotherTheme ); // second query, ID 2 + store.dispatch( actionReceiveEvenMoreThemes ); // receive themes from second query (ID 2) + store.dispatch( actionReceiveThemes ); // receive themes from first query (ID 1) + } ); + + it( 'only takes into account the last query results', () => { + assert( getThemesList().length === 2 ); + assert( getThemesList()[0] === '2014' ); + } ); + } ); +} ); diff --git a/shared/lib/themes/test/themes-store.js b/shared/lib/themes/test/themes-store.js deleted file mode 100644 index 313e650684cdc..0000000000000 --- a/shared/lib/themes/test/themes-store.js +++ /dev/null @@ -1,74 +0,0 @@ -var assert = require( 'chai' ).assert, - rewire = require( 'rewire' ); - -var ThemeConstants = require( 'lib/themes/constants' ); - -describe( 'ThemesStore', function() { - var ThemesStore, registeredCallback, - actionReceiveThemes = { - action: { - type: ThemeConstants.RECEIVE_THEMES, - themes: [ - { id: 'bold-news', active: true }, - { id: 'picard' } - ] - }, - }, - actionReceiveMoreThemes = { - action: { - type: ThemeConstants.RECEIVE_THEMES, - themes: [ - { id: 'picard' }, - { id: 'hue' } - ] - } - }, - actionThemeActivated = { - action: { - type: ThemeConstants.ACTIVATED_THEME, - theme: { id: 'picard' } - } - }; - - beforeEach( function() { - ThemesStore = rewire( 'lib/themes/themes-store' ); - registeredCallback = ThemesStore.__get__( 'registeredCallback' ); - } ); - - describe( 'get()', function() { - beforeEach( function() { - registeredCallback( actionReceiveThemes ); - } ); - - it( 'returns all themes', function() { - var themes = ThemesStore.get(); - - assert( Object.keys( themes ).length === 2, 'Wrong number of themes' ); - } ); - } ); - - context( 'when THEMES_RECEIVE is received', function() { - beforeEach( function() { - registeredCallback( actionReceiveThemes ); - } ); - - it( 'removes duplicates', function() { - registeredCallback( actionReceiveMoreThemes ); - - assert( Object.keys( ThemesStore.get() ).length === 3, 'duplicates found' ); - } ); - } ); - - context( 'when ACTIVATED_THEME is received', function() { - beforeEach( function() { - registeredCallback( actionReceiveThemes ); - } ); - - it( 'clears previous active flag', function() { - assert.ok( ThemesStore.getById( 'bold-news' ).active, 'initial theme not active' ); - registeredCallback( actionThemeActivated ); - assert.notOk( ThemesStore.getById( 'bold-news' ).active, 'initial theme still active' ); - assert.ok( ThemesStore.getById( 'picard' ).active, 'new theme not active' ); - } ); - } ); -} ); diff --git a/shared/lib/themes/test/themes.js b/shared/lib/themes/test/themes.js new file mode 100644 index 0000000000000..428df5c6e234b --- /dev/null +++ b/shared/lib/themes/test/themes.js @@ -0,0 +1,74 @@ +import { assert } from 'chai'; + +import { createStore } from 'redux'; + +import ThemeConstants from '../constants'; +import reducer from '../reducers/themes'; + +describe( 'themes', () => { + const actionReceiveThemes = { + type: ThemeConstants.RECEIVE_THEMES, + themes: [ + { id: 'bold-news', active: true }, + { id: 'picard' } + ] + }; + const actionReceiveMoreThemes = { + type: ThemeConstants.RECEIVE_THEMES, + themes: [ + { id: 'picard' }, + { id: 'hue' } + ] + }; + const actionThemeActivated = { + type: ThemeConstants.ACTIVATED_THEME, + theme: { id: 'picard' } + }; + + let store; + + function getThemeById( id ) { + const theme = store.getState().getIn( [ 'themes', id ] ); + return theme ? theme.toJS() : undefined; + } + + beforeEach( () => { + store = createStore( reducer ); + } ); + + describe( 'get()', () => { + beforeEach( () => { + store.dispatch( actionReceiveThemes ); + } ); + + it( 'returns all themes', () => { + const themes = store.getState().get( 'themes' ); + assert( themes.size === 2, 'Wrong number of themes' ); + } ); + } ); + + context( 'when THEMES_RECEIVE is received', () => { + beforeEach( () => { + store.dispatch( actionReceiveThemes ); + } ); + + it( 'removes duplicates', () => { + store.dispatch( actionReceiveMoreThemes ); + const themes = store.getState().get( 'themes' ); + assert( themes.size === 3, 'duplicates found' ); + } ); + } ); + + context( 'when ACTIVATED_THEME is received', () => { + beforeEach( () => { + store.dispatch( actionReceiveThemes ); + } ); + + it( 'clears previous active flag', () => { + assert.ok( getThemeById( 'bold-news' ).active, 'initial theme not active' ); + store.dispatch( actionThemeActivated ); + assert.notOk( getThemeById( 'bold-news' ).active, 'initial theme still active' ); + assert.ok( getThemeById( 'picard' ).active, 'new theme not active' ); + } ); + } ); +} );