@coorpacademy/components 10.1.4 → 10.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/button-link/index.js +7 -22
- package/es/atom/button-link/index.js.map +1 -1
- package/es/atom/button-link/style.css +4 -6
- package/es/atom/button-link/test/fixtures.js +33 -0
- package/es/atom/button-link/test/fixtures.js.map +1 -0
- package/es/atom/button-link-icon-only/index.js +76 -0
- package/es/atom/button-link-icon-only/index.js.map +1 -0
- package/es/atom/button-link-icon-only/style.css +64 -0
- package/es/atom/button-link-icon-only/test/button-link-icon-only.js +25 -0
- package/es/atom/button-link-icon-only/test/button-link-icon-only.js.map +1 -0
- package/es/atom/button-link-icon-only/test/fixtures/button-icon-bullet.js +10 -0
- package/es/atom/button-link-icon-only/test/fixtures/button-icon-bullet.js.map +1 -0
- package/es/atom/{button-link/test/fixtures/icon-button.js → button-link-icon-only/test/fixtures/default.js} +3 -6
- package/es/atom/button-link-icon-only/test/fixtures/default.js.map +1 -0
- package/es/atom/button-link-icon-only/test/fixtures/no-icon.js +7 -0
- package/es/atom/button-link-icon-only/test/fixtures/no-icon.js.map +1 -0
- package/es/atom/button-link-icon-only/test/fixtures/small-button-disabled.js +11 -0
- package/es/atom/button-link-icon-only/test/fixtures/small-button-disabled.js.map +1 -0
- package/es/atom/button-link-icon-only/test/fixtures/small-link-download.js +13 -0
- package/es/atom/button-link-icon-only/test/fixtures/small-link-download.js.map +1 -0
- package/es/atom/button-menu/index.js +66 -0
- package/es/atom/button-menu/index.js.map +1 -0
- package/es/atom/button-menu/style.css +51 -0
- package/es/atom/button-menu/test/fixtures/default.js +20 -0
- package/es/atom/button-menu/test/fixtures/default.js.map +1 -0
- package/es/atom/button-menu/test/fixtures/multiple-buttons.js +15 -0
- package/es/atom/button-menu/test/fixtures/multiple-buttons.js.map +1 -0
- package/es/atom/chips/index.js +8 -4
- package/es/atom/chips/index.js.map +1 -1
- package/es/atom/chips/style.css +17 -2
- package/es/atom/chips/test/fixtures/long-text.js +9 -0
- package/es/atom/chips/test/fixtures/long-text.js.map +1 -0
- package/es/atom/chips/test/fixtures.js +17 -0
- package/es/atom/chips/test/fixtures.js.map +1 -0
- package/es/atom/content-badge/test/fixtures.js +27 -0
- package/es/atom/content-badge/test/fixtures.js.map +1 -0
- package/es/atom/input-checkbox/test/fixtures.js +2 -0
- package/es/atom/input-checkbox/test/fixtures.js.map +1 -1
- package/es/atom/input-search/style.css +1 -0
- package/es/atom/input-search/test/fixtures.js +19 -0
- package/es/atom/input-search/test/fixtures.js.map +1 -0
- package/es/atom/input-text/index.js.map +1 -1
- package/es/atom/input-text/style.css +6 -2
- package/es/atom/input-text/test/fixtures.js +2 -0
- package/es/atom/input-text/test/fixtures.js.map +1 -1
- package/es/atom/input-textarea/style.css +3 -3
- package/es/atom/input-textarea/test/fixtures.js +4 -0
- package/es/atom/input-textarea/test/fixtures.js.map +1 -1
- package/es/atom/tag/test/fixtures.js +19 -0
- package/es/atom/tag/test/fixtures.js.map +1 -0
- package/es/atom/title/test/fixtures.js +6 -2
- package/es/atom/title/test/fixtures.js.map +1 -1
- package/es/atom/wizard-steps/test/fixtures.js +17 -0
- package/es/atom/wizard-steps/test/fixtures.js.map +1 -0
- package/es/molecule/banner/index.js +19 -10
- package/es/molecule/banner/index.js.map +1 -1
- package/es/molecule/banner/style.css +10 -8
- package/es/molecule/banner/test/fixtures.js +15 -0
- package/es/molecule/banner/test/fixtures.js.map +1 -0
- package/es/molecule/brand-form-group/index.js +20 -5
- package/es/molecule/brand-form-group/index.js.map +1 -1
- package/es/molecule/brand-form-group/style.css +19 -0
- package/es/molecule/brand-form-group/test/fixtures.js +2 -0
- package/es/molecule/brand-form-group/test/fixtures.js.map +1 -1
- package/es/molecule/bullet-point-menu-button/index.js +51 -0
- package/es/molecule/bullet-point-menu-button/index.js.map +1 -0
- package/es/molecule/bullet-point-menu-button/style.css +52 -0
- package/es/molecule/bullet-point-menu-button/test/bullet-point-menu-button.js +34 -0
- package/es/molecule/bullet-point-menu-button/test/bullet-point-menu-button.js.map +1 -0
- package/es/molecule/bullet-point-menu-button/test/fixtures/default.js +11 -0
- package/es/molecule/bullet-point-menu-button/test/fixtures/default.js.map +1 -0
- package/es/molecule/bullet-point-menu-button/test/fixtures/multiple-buttons.js +13 -0
- package/es/molecule/bullet-point-menu-button/test/fixtures/multiple-buttons.js.map +1 -0
- package/es/molecule/card/test/fixtures.js +4 -0
- package/es/molecule/card/test/fixtures.js.map +1 -1
- package/es/molecule/cm-popin/index.js +8 -7
- package/es/molecule/cm-popin/index.js.map +1 -1
- package/es/molecule/cm-popin/style.css +0 -25
- package/es/molecule/cm-popin/test/fixtures.js +17 -0
- package/es/molecule/cm-popin/test/fixtures.js.map +1 -0
- package/es/molecule/coorp-manager-roles/test/fixtures.js +13 -0
- package/es/molecule/coorp-manager-roles/test/fixtures.js.map +1 -0
- package/es/molecule/popin/test/fixtures.js +21 -0
- package/es/molecule/popin/test/fixtures.js.map +1 -0
- package/es/molecule/quick-access-card/test/fixtures.js +21 -0
- package/es/molecule/quick-access-card/test/fixtures.js.map +1 -0
- package/es/molecule/quick-access-cards-group/test/fixtures.js +21 -0
- package/es/molecule/quick-access-cards-group/test/fixtures.js.map +1 -0
- package/es/molecule/select-multiple/index.js +113 -146
- package/es/molecule/select-multiple/index.js.map +1 -1
- package/es/molecule/select-multiple/test/index.js +20 -79
- package/es/molecule/select-multiple/test/index.js.map +1 -1
- package/es/molecule/vertical-tabs/index.js +8 -3
- package/es/molecule/vertical-tabs/index.js.map +1 -1
- package/es/molecule/vertical-tabs/test/fixtures/default.js +2 -1
- package/es/molecule/vertical-tabs/test/fixtures/default.js.map +1 -1
- package/es/molecule/vertical-tabs/test/fixtures/with-selected-item.js +2 -1
- package/es/molecule/vertical-tabs/test/fixtures/with-selected-item.js.map +1 -1
- package/es/molecule/vertical-tabs/test/fixtures.js +15 -0
- package/es/molecule/vertical-tabs/test/fixtures.js.map +1 -0
- package/es/molecule/wizard-summary/index.js +3 -1
- package/es/molecule/wizard-summary/index.js.map +1 -1
- package/es/molecule/wizard-summary/style.css +8 -0
- package/es/molecule/wizard-summary/test/fixtures.js +21 -0
- package/es/molecule/wizard-summary/test/fixtures.js.map +1 -0
- package/es/organism/accordion/coorp-manager/part/test/fixtures.js +4 -0
- package/es/organism/accordion/coorp-manager/part/test/fixtures.js.map +1 -1
- package/es/organism/brand-analytics/test/fixtures.js +23 -0
- package/es/organism/brand-analytics/test/fixtures.js.map +1 -0
- package/es/organism/brand-dashboard/test/fixtures.js +2 -10
- package/es/organism/brand-dashboard/test/fixtures.js.map +1 -1
- package/es/organism/brand-form/test/fixtures/wizard-playlists.js +26 -0
- package/es/organism/brand-form/test/fixtures/wizard-playlists.js.map +1 -0
- package/es/organism/playlist-translation/index.js +63 -0
- package/es/organism/playlist-translation/index.js.map +1 -0
- package/es/organism/playlist-translation/style.css +45 -0
- package/es/organism/playlist-translation/test/fixtures/default.js +24 -0
- package/es/organism/playlist-translation/test/fixtures/default.js.map +1 -0
- package/es/organism/playlist-translation/test/fixtures/delete.js +18 -0
- package/es/organism/playlist-translation/test/fixtures/delete.js.map +1 -0
- package/es/organism/playlist-translation/test/fixtures.js +15 -0
- package/es/organism/playlist-translation/test/fixtures.js.map +1 -0
- package/es/organism/search-and-chips-results/index.js +92 -0
- package/es/organism/search-and-chips-results/index.js.map +1 -0
- package/es/organism/search-and-chips-results/style.css +57 -0
- package/es/organism/search-and-chips-results/test/fixtures/default.js +46 -0
- package/es/organism/search-and-chips-results/test/fixtures/default.js.map +1 -0
- package/es/organism/search-and-chips-results/test/fixtures/empty.js +23 -0
- package/es/organism/search-and-chips-results/test/fixtures/empty.js.map +1 -0
- package/es/organism/search-and-chips-results/test/fixtures/filtered.js +26 -0
- package/es/organism/search-and-chips-results/test/fixtures/filtered.js.map +1 -0
- package/es/organism/search-and-chips-results/test/fixtures/sorted-selected.js +49 -0
- package/es/organism/search-and-chips-results/test/fixtures/sorted-selected.js.map +1 -0
- package/es/organism/search-and-chips-results/test/fixtures/unsorted-selected.js +49 -0
- package/es/organism/search-and-chips-results/test/fixtures/unsorted-selected.js.map +1 -0
- package/es/organism/search-and-chips-results/test/fixtures.js +21 -0
- package/es/organism/search-and-chips-results/test/fixtures.js.map +1 -0
- package/es/organism/setup-header/index.js +78 -31
- package/es/organism/setup-header/index.js.map +1 -1
- package/es/organism/setup-header/style.css +27 -62
- package/es/template/back-office/brand-update/test/fixtures.js +2 -0
- package/es/template/back-office/brand-update/test/fixtures.js.map +1 -1
- package/es/template/teams-dashboard/index.js +4 -3
- package/es/template/teams-dashboard/index.js.map +1 -1
- package/es/util/button-icons.js +16 -0
- package/es/util/button-icons.js.map +1 -0
- package/es/variables/colors.css +2 -0
- package/lib/atom/button-link/index.js +9 -24
- package/lib/atom/button-link/index.js.map +1 -1
- package/lib/atom/button-link/style.css +4 -6
- package/lib/atom/button-link/test/fixtures.js +52 -0
- package/lib/atom/button-link/test/fixtures.js.map +1 -0
- package/lib/atom/button-link-icon-only/index.js +94 -0
- package/lib/atom/button-link-icon-only/index.js.map +1 -0
- package/lib/atom/button-link-icon-only/style.css +64 -0
- package/lib/atom/button-link-icon-only/test/button-link-icon-only.js +37 -0
- package/lib/atom/button-link-icon-only/test/button-link-icon-only.js.map +1 -0
- package/lib/atom/button-link-icon-only/test/fixtures/button-icon-bullet.js +15 -0
- package/lib/atom/button-link-icon-only/test/fixtures/button-icon-bullet.js.map +1 -0
- package/lib/atom/{button-link/test/fixtures/icon-button.js → button-link-icon-only/test/fixtures/default.js} +3 -6
- package/lib/atom/button-link-icon-only/test/fixtures/default.js.map +1 -0
- package/lib/atom/button-link-icon-only/test/fixtures/no-icon.js +12 -0
- package/lib/atom/button-link-icon-only/test/fixtures/no-icon.js.map +1 -0
- package/lib/atom/button-link-icon-only/test/fixtures/small-button-disabled.js +16 -0
- package/lib/atom/button-link-icon-only/test/fixtures/small-button-disabled.js.map +1 -0
- package/lib/atom/button-link-icon-only/test/fixtures/small-link-download.js +18 -0
- package/lib/atom/button-link-icon-only/test/fixtures/small-link-download.js.map +1 -0
- package/lib/atom/button-menu/index.js +82 -0
- package/lib/atom/button-menu/index.js.map +1 -0
- package/lib/atom/button-menu/style.css +51 -0
- package/lib/atom/button-menu/test/fixtures/default.js +27 -0
- package/lib/atom/button-menu/test/fixtures/default.js.map +1 -0
- package/lib/atom/button-menu/test/fixtures/multiple-buttons.js +23 -0
- package/lib/atom/button-menu/test/fixtures/multiple-buttons.js.map +1 -0
- package/lib/atom/chips/index.js +8 -4
- package/lib/atom/chips/index.js.map +1 -1
- package/lib/atom/chips/style.css +17 -2
- package/lib/atom/chips/test/fixtures/long-text.js +14 -0
- package/lib/atom/chips/test/fixtures/long-text.js.map +1 -0
- package/lib/atom/chips/test/fixtures.js +28 -0
- package/lib/atom/chips/test/fixtures.js.map +1 -0
- package/lib/atom/content-badge/test/fixtures.js +43 -0
- package/lib/atom/content-badge/test/fixtures.js.map +1 -0
- package/lib/atom/input-checkbox/test/fixtures.js +3 -0
- package/lib/atom/input-checkbox/test/fixtures.js.map +1 -1
- package/lib/atom/input-search/style.css +1 -0
- package/lib/atom/input-search/test/fixtures.js +31 -0
- package/lib/atom/input-search/test/fixtures.js.map +1 -0
- package/lib/atom/input-text/index.js.map +1 -1
- package/lib/atom/input-text/style.css +6 -2
- package/lib/atom/input-text/test/fixtures.js +3 -0
- package/lib/atom/input-text/test/fixtures.js.map +1 -1
- package/lib/atom/input-textarea/style.css +3 -3
- package/lib/atom/input-textarea/test/fixtures.js +6 -0
- package/lib/atom/input-textarea/test/fixtures.js.map +1 -1
- package/lib/atom/tag/test/fixtures.js +31 -0
- package/lib/atom/tag/test/fixtures.js.map +1 -0
- package/lib/atom/title/test/fixtures.js +8 -2
- package/lib/atom/title/test/fixtures.js.map +1 -1
- package/lib/atom/wizard-steps/test/fixtures.js +28 -0
- package/lib/atom/wizard-steps/test/fixtures.js.map +1 -0
- package/lib/molecule/banner/index.js +19 -10
- package/lib/molecule/banner/index.js.map +1 -1
- package/lib/molecule/banner/style.css +10 -8
- package/lib/molecule/banner/test/fixtures.js +25 -0
- package/lib/molecule/banner/test/fixtures.js.map +1 -0
- package/lib/molecule/brand-form-group/index.js +22 -5
- package/lib/molecule/brand-form-group/index.js.map +1 -1
- package/lib/molecule/brand-form-group/style.css +19 -0
- package/lib/molecule/brand-form-group/test/fixtures.js +3 -0
- package/lib/molecule/brand-form-group/test/fixtures.js.map +1 -1
- package/lib/molecule/bullet-point-menu-button/index.js +69 -0
- package/lib/molecule/bullet-point-menu-button/index.js.map +1 -0
- package/lib/molecule/bullet-point-menu-button/style.css +52 -0
- package/lib/molecule/bullet-point-menu-button/test/bullet-point-menu-button.js +46 -0
- package/lib/molecule/bullet-point-menu-button/test/bullet-point-menu-button.js.map +1 -0
- package/lib/molecule/bullet-point-menu-button/test/fixtures/default.js +18 -0
- package/lib/molecule/bullet-point-menu-button/test/fixtures/default.js.map +1 -0
- package/lib/molecule/bullet-point-menu-button/test/fixtures/multiple-buttons.js +25 -0
- package/lib/molecule/bullet-point-menu-button/test/fixtures/multiple-buttons.js.map +1 -0
- package/lib/molecule/card/test/fixtures.js +6 -0
- package/lib/molecule/card/test/fixtures.js.map +1 -1
- package/lib/molecule/cm-popin/index.js +8 -6
- package/lib/molecule/cm-popin/index.js.map +1 -1
- package/lib/molecule/cm-popin/style.css +0 -25
- package/lib/molecule/cm-popin/test/fixtures.js +28 -0
- package/lib/molecule/cm-popin/test/fixtures.js.map +1 -0
- package/lib/molecule/coorp-manager-roles/test/fixtures.js +22 -0
- package/lib/molecule/coorp-manager-roles/test/fixtures.js.map +1 -0
- package/lib/molecule/popin/test/fixtures.js +34 -0
- package/lib/molecule/popin/test/fixtures.js.map +1 -0
- package/lib/molecule/quick-access-card/test/fixtures.js +34 -0
- package/lib/molecule/quick-access-card/test/fixtures.js.map +1 -0
- package/lib/molecule/quick-access-cards-group/test/fixtures.js +34 -0
- package/lib/molecule/quick-access-cards-group/test/fixtures.js.map +1 -0
- package/lib/molecule/select-multiple/index.js +117 -143
- package/lib/molecule/select-multiple/index.js.map +1 -1
- package/lib/molecule/select-multiple/test/index.js +25 -79
- package/lib/molecule/select-multiple/test/index.js.map +1 -1
- package/lib/molecule/vertical-tabs/index.js +8 -3
- package/lib/molecule/vertical-tabs/index.js.map +1 -1
- package/lib/molecule/vertical-tabs/test/fixtures/default.js +2 -1
- package/lib/molecule/vertical-tabs/test/fixtures/default.js.map +1 -1
- package/lib/molecule/vertical-tabs/test/fixtures/with-selected-item.js +2 -1
- package/lib/molecule/vertical-tabs/test/fixtures/with-selected-item.js.map +1 -1
- package/lib/molecule/vertical-tabs/test/fixtures.js +25 -0
- package/lib/molecule/vertical-tabs/test/fixtures.js.map +1 -0
- package/lib/molecule/wizard-summary/index.js +3 -1
- package/lib/molecule/wizard-summary/index.js.map +1 -1
- package/lib/molecule/wizard-summary/style.css +8 -0
- package/lib/molecule/wizard-summary/test/fixtures.js +34 -0
- package/lib/molecule/wizard-summary/test/fixtures.js.map +1 -0
- package/lib/organism/accordion/coorp-manager/part/test/fixtures.js +6 -0
- package/lib/organism/accordion/coorp-manager/part/test/fixtures.js.map +1 -1
- package/lib/organism/brand-analytics/test/fixtures.js +37 -0
- package/lib/organism/brand-analytics/test/fixtures.js.map +1 -0
- package/lib/organism/brand-dashboard/test/fixtures.js +2 -14
- package/lib/organism/brand-dashboard/test/fixtures.js.map +1 -1
- package/lib/organism/brand-form/test/fixtures/wizard-playlists.js +31 -0
- package/lib/organism/brand-form/test/fixtures/wizard-playlists.js.map +1 -0
- package/lib/organism/playlist-translation/index.js +78 -0
- package/lib/organism/playlist-translation/index.js.map +1 -0
- package/lib/organism/playlist-translation/style.css +45 -0
- package/lib/organism/playlist-translation/test/fixtures/default.js +35 -0
- package/lib/organism/playlist-translation/test/fixtures/default.js.map +1 -0
- package/lib/organism/playlist-translation/test/fixtures/delete.js +29 -0
- package/lib/organism/playlist-translation/test/fixtures/delete.js.map +1 -0
- package/lib/organism/playlist-translation/test/fixtures.js +25 -0
- package/lib/organism/playlist-translation/test/fixtures.js.map +1 -0
- package/lib/organism/search-and-chips-results/index.js +105 -0
- package/lib/organism/search-and-chips-results/index.js.map +1 -0
- package/lib/organism/search-and-chips-results/style.css +57 -0
- package/lib/organism/search-and-chips-results/test/fixtures/default.js +51 -0
- package/lib/organism/search-and-chips-results/test/fixtures/default.js.map +1 -0
- package/lib/organism/search-and-chips-results/test/fixtures/empty.js +28 -0
- package/lib/organism/search-and-chips-results/test/fixtures/empty.js.map +1 -0
- package/lib/organism/search-and-chips-results/test/fixtures/filtered.js +31 -0
- package/lib/organism/search-and-chips-results/test/fixtures/filtered.js.map +1 -0
- package/lib/organism/search-and-chips-results/test/fixtures/sorted-selected.js +54 -0
- package/lib/organism/search-and-chips-results/test/fixtures/sorted-selected.js.map +1 -0
- package/lib/organism/search-and-chips-results/test/fixtures/unsorted-selected.js +54 -0
- package/lib/organism/search-and-chips-results/test/fixtures/unsorted-selected.js.map +1 -0
- package/lib/organism/search-and-chips-results/test/fixtures.js +34 -0
- package/lib/organism/search-and-chips-results/test/fixtures.js.map +1 -0
- package/lib/organism/setup-header/index.js +80 -32
- package/lib/organism/setup-header/index.js.map +1 -1
- package/lib/organism/setup-header/style.css +27 -62
- package/lib/template/back-office/brand-update/test/fixtures.js +3 -0
- package/lib/template/back-office/brand-update/test/fixtures.js.map +1 -1
- package/lib/template/teams-dashboard/index.js +3 -1
- package/lib/template/teams-dashboard/index.js.map +1 -1
- package/lib/util/button-icons.js +23 -0
- package/lib/util/button-icons.js.map +1 -0
- package/lib/variables/colors.css +2 -0
- package/package.json +3 -3
- package/es/atom/button-link/test/fixtures/icon-button.js.map +0 -1
- package/es/molecule/cockpit-popin/test/fixtures.js +0 -17
- package/es/molecule/cockpit-popin/test/fixtures.js.map +0 -1
- package/lib/atom/button-link/test/fixtures/icon-button.js.map +0 -1
- package/lib/molecule/cockpit-popin/test/fixtures.js +0 -28
- package/lib/molecule/cockpit-popin/test/fixtures.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import forEach from 'lodash/forEach';
|
|
3
|
+
import renderComponentMacro from '../../../test/helpers/render-component';
|
|
4
|
+
import MoleculeCmPopin from '..';
|
|
5
|
+
import fixtureDangerous from './fixtures/dangerous';
|
|
6
|
+
import fixtureDefault from './fixtures/default';
|
|
7
|
+
import fixtureWarningWithClose from './fixtures/warning-with-close';
|
|
8
|
+
test('Molecule › MoleculeCmPopin > should have valid propTypes', t => {
|
|
9
|
+
t.pass();
|
|
10
|
+
forEach(MoleculeCmPopin.propTypes, (value, key) => {
|
|
11
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculeCmPopin.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
test('Molecule › MoleculeCmPopin › Dangerous › should be rendered', renderComponentMacro, MoleculeCmPopin, fixtureDangerous);
|
|
15
|
+
test('Molecule › MoleculeCmPopin › Default › should be rendered', renderComponentMacro, MoleculeCmPopin, fixtureDefault);
|
|
16
|
+
test('Molecule › MoleculeCmPopin › WarningWithClose › should be rendered', renderComponentMacro, MoleculeCmPopin, fixtureWarningWithClose);
|
|
17
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/cm-popin/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeCmPopin","fixtureDangerous","fixtureDefault","fixtureWarningWithClose","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,eAAP,MAA4B,IAA5B;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEAN,IAAI,CAAC,0DAAD,EAA6DO,CAAC,IAAI;AACpEA,EAAAA,CAAC,CAACC,IAAF;AACAP,EAAAA,OAAO,CAACE,eAAe,CAACM,SAAjB,EAA4B,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACjDJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,oDAAmDF,GAAI,mEAAhF;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAX,IAAI,CAAC,6DAAD,EAAgEE,oBAAhE,EAAsFC,eAAtF,EAAuGC,gBAAvG,CAAJ;AACAJ,IAAI,CAAC,2DAAD,EAA8DE,oBAA9D,EAAoFC,eAApF,EAAqGE,cAArG,CAAJ;AACAL,IAAI,CAAC,oEAAD,EAAuEE,oBAAvE,EAA6FC,eAA7F,EAA8GG,uBAA9G,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeCmPopin from '..';\nimport fixtureDangerous from './fixtures/dangerous';\nimport fixtureDefault from './fixtures/default';\nimport fixtureWarningWithClose from './fixtures/warning-with-close';\n\ntest('Molecule › MoleculeCmPopin > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeCmPopin.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeCmPopin.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeCmPopin › Dangerous › should be rendered', renderComponentMacro, MoleculeCmPopin, fixtureDangerous);\ntest('Molecule › MoleculeCmPopin › Default › should be rendered', renderComponentMacro, MoleculeCmPopin, fixtureDefault);\ntest('Molecule › MoleculeCmPopin › WarningWithClose › should be rendered', renderComponentMacro, MoleculeCmPopin, fixtureWarningWithClose);\n"],"file":"fixtures.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import forEach from 'lodash/forEach';
|
|
3
|
+
import renderComponentMacro from '../../../test/helpers/render-component';
|
|
4
|
+
import MoleculeCoorpManagerRoles from '..';
|
|
5
|
+
import fixtureDefault from './fixtures/default';
|
|
6
|
+
test('Molecule › MoleculeCoorpManagerRoles > should have valid propTypes', t => {
|
|
7
|
+
t.pass();
|
|
8
|
+
forEach(MoleculeCoorpManagerRoles.propTypes, (value, key) => {
|
|
9
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculeCoorpManagerRoles.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
test('Molecule › MoleculeCoorpManagerRoles › Default › should be rendered', renderComponentMacro, MoleculeCoorpManagerRoles, fixtureDefault);
|
|
13
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/coorp-manager-roles/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeCoorpManagerRoles","fixtureDefault","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,yBAAP,MAAsC,IAAtC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AAEAJ,IAAI,CAAC,oEAAD,EAAuEK,CAAC,IAAI;AAC9EA,EAAAA,CAAC,CAACC,IAAF;AACAL,EAAAA,OAAO,CAACE,yBAAyB,CAACI,SAA3B,EAAsC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC3DJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,8DAA6DF,GAAI,mEAA1F;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAT,IAAI,CAAC,qEAAD,EAAwEE,oBAAxE,EAA8FC,yBAA9F,EAAyHC,cAAzH,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeCoorpManagerRoles from '..';\nimport fixtureDefault from './fixtures/default';\n\ntest('Molecule › MoleculeCoorpManagerRoles > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeCoorpManagerRoles.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeCoorpManagerRoles.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeCoorpManagerRoles › Default › should be rendered', renderComponentMacro, MoleculeCoorpManagerRoles, fixtureDefault);\n"],"file":"fixtures.js"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import forEach from 'lodash/forEach';
|
|
3
|
+
import renderComponentMacro from '../../../test/helpers/render-component';
|
|
4
|
+
import MoleculePopin from '..';
|
|
5
|
+
import fixtureAssistance from './fixtures/assistance';
|
|
6
|
+
import fixtureBackgroundNoSecondButton from './fixtures/background-no-second-button';
|
|
7
|
+
import fixtureDefault from './fixtures/default';
|
|
8
|
+
import fixtureLoading from './fixtures/loading';
|
|
9
|
+
import fixtureVideoTranslate from './fixtures/video-translate';
|
|
10
|
+
test('Molecule › MoleculePopin > should have valid propTypes', t => {
|
|
11
|
+
t.pass();
|
|
12
|
+
forEach(MoleculePopin.propTypes, (value, key) => {
|
|
13
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculePopin.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
test('Molecule › MoleculePopin › Assistance › should be rendered', renderComponentMacro, MoleculePopin, fixtureAssistance);
|
|
17
|
+
test('Molecule › MoleculePopin › BackgroundNoSecondButton › should be rendered', renderComponentMacro, MoleculePopin, fixtureBackgroundNoSecondButton);
|
|
18
|
+
test('Molecule › MoleculePopin › Default › should be rendered', renderComponentMacro, MoleculePopin, fixtureDefault);
|
|
19
|
+
test('Molecule › MoleculePopin › Loading › should be rendered', renderComponentMacro, MoleculePopin, fixtureLoading);
|
|
20
|
+
test('Molecule › MoleculePopin › VideoTranslate › should be rendered', renderComponentMacro, MoleculePopin, fixtureVideoTranslate);
|
|
21
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/popin/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculePopin","fixtureAssistance","fixtureBackgroundNoSecondButton","fixtureDefault","fixtureLoading","fixtureVideoTranslate","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,aAAP,MAA0B,IAA1B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,+BAAP,MAA4C,wCAA5C;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEAR,IAAI,CAAC,wDAAD,EAA2DS,CAAC,IAAI;AAClEA,EAAAA,CAAC,CAACC,IAAF;AACAT,EAAAA,OAAO,CAACE,aAAa,CAACQ,SAAf,EAA0B,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC/CJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,kDAAiDF,GAAI,mEAA9E;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAb,IAAI,CAAC,4DAAD,EAA+DE,oBAA/D,EAAqFC,aAArF,EAAoGC,iBAApG,CAAJ;AACAJ,IAAI,CAAC,0EAAD,EAA6EE,oBAA7E,EAAmGC,aAAnG,EAAkHE,+BAAlH,CAAJ;AACAL,IAAI,CAAC,yDAAD,EAA4DE,oBAA5D,EAAkFC,aAAlF,EAAiGG,cAAjG,CAAJ;AACAN,IAAI,CAAC,yDAAD,EAA4DE,oBAA5D,EAAkFC,aAAlF,EAAiGI,cAAjG,CAAJ;AACAP,IAAI,CAAC,gEAAD,EAAmEE,oBAAnE,EAAyFC,aAAzF,EAAwGK,qBAAxG,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculePopin from '..';\nimport fixtureAssistance from './fixtures/assistance';\nimport fixtureBackgroundNoSecondButton from './fixtures/background-no-second-button';\nimport fixtureDefault from './fixtures/default';\nimport fixtureLoading from './fixtures/loading';\nimport fixtureVideoTranslate from './fixtures/video-translate';\n\ntest('Molecule › MoleculePopin > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculePopin.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculePopin.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculePopin › Assistance › should be rendered', renderComponentMacro, MoleculePopin, fixtureAssistance);\ntest('Molecule › MoleculePopin › BackgroundNoSecondButton › should be rendered', renderComponentMacro, MoleculePopin, fixtureBackgroundNoSecondButton);\ntest('Molecule › MoleculePopin › Default › should be rendered', renderComponentMacro, MoleculePopin, fixtureDefault);\ntest('Molecule › MoleculePopin › Loading › should be rendered', renderComponentMacro, MoleculePopin, fixtureLoading);\ntest('Molecule › MoleculePopin › VideoTranslate › should be rendered', renderComponentMacro, MoleculePopin, fixtureVideoTranslate);\n"],"file":"fixtures.js"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import forEach from 'lodash/forEach';
|
|
3
|
+
import renderComponentMacro from '../../../test/helpers/render-component';
|
|
4
|
+
import MoleculeQuickAccessCard from '..';
|
|
5
|
+
import fixtureAnalytics from './fixtures/analytics';
|
|
6
|
+
import fixtureDefault from './fixtures/default';
|
|
7
|
+
import fixtureLookAndFeel from './fixtures/look-and-feel';
|
|
8
|
+
import fixtureMassiveBattle from './fixtures/massive-battle';
|
|
9
|
+
import fixtureUploadUsers from './fixtures/upload-users';
|
|
10
|
+
test('Molecule › MoleculeQuickAccessCard > should have valid propTypes', t => {
|
|
11
|
+
t.pass();
|
|
12
|
+
forEach(MoleculeQuickAccessCard.propTypes, (value, key) => {
|
|
13
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculeQuickAccessCard.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
test('Molecule › MoleculeQuickAccessCard › Analytics › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureAnalytics);
|
|
17
|
+
test('Molecule › MoleculeQuickAccessCard › Default › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureDefault);
|
|
18
|
+
test('Molecule › MoleculeQuickAccessCard › LookAndFeel › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureLookAndFeel);
|
|
19
|
+
test('Molecule › MoleculeQuickAccessCard › MassiveBattle › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureMassiveBattle);
|
|
20
|
+
test('Molecule › MoleculeQuickAccessCard › UploadUsers › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureUploadUsers);
|
|
21
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/quick-access-card/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeQuickAccessCard","fixtureAnalytics","fixtureDefault","fixtureLookAndFeel","fixtureMassiveBattle","fixtureUploadUsers","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,uBAAP,MAAoC,IAApC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,kBAAP,MAA+B,0BAA/B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AAEAR,IAAI,CAAC,kEAAD,EAAqES,CAAC,IAAI;AAC5EA,EAAAA,CAAC,CAACC,IAAF;AACAT,EAAAA,OAAO,CAACE,uBAAuB,CAACQ,SAAzB,EAAoC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACzDJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,4DAA2DF,GAAI,mEAAxF;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAb,IAAI,CAAC,qEAAD,EAAwEE,oBAAxE,EAA8FC,uBAA9F,EAAuHC,gBAAvH,CAAJ;AACAJ,IAAI,CAAC,mEAAD,EAAsEE,oBAAtE,EAA4FC,uBAA5F,EAAqHE,cAArH,CAAJ;AACAL,IAAI,CAAC,uEAAD,EAA0EE,oBAA1E,EAAgGC,uBAAhG,EAAyHG,kBAAzH,CAAJ;AACAN,IAAI,CAAC,yEAAD,EAA4EE,oBAA5E,EAAkGC,uBAAlG,EAA2HI,oBAA3H,CAAJ;AACAP,IAAI,CAAC,uEAAD,EAA0EE,oBAA1E,EAAgGC,uBAAhG,EAAyHK,kBAAzH,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeQuickAccessCard from '..';\nimport fixtureAnalytics from './fixtures/analytics';\nimport fixtureDefault from './fixtures/default';\nimport fixtureLookAndFeel from './fixtures/look-and-feel';\nimport fixtureMassiveBattle from './fixtures/massive-battle';\nimport fixtureUploadUsers from './fixtures/upload-users';\n\ntest('Molecule › MoleculeQuickAccessCard > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeQuickAccessCard.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeQuickAccessCard.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeQuickAccessCard › Analytics › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureAnalytics);\ntest('Molecule › MoleculeQuickAccessCard › Default › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureDefault);\ntest('Molecule › MoleculeQuickAccessCard › LookAndFeel › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureLookAndFeel);\ntest('Molecule › MoleculeQuickAccessCard › MassiveBattle › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureMassiveBattle);\ntest('Molecule › MoleculeQuickAccessCard › UploadUsers › should be rendered', renderComponentMacro, MoleculeQuickAccessCard, fixtureUploadUsers);\n"],"file":"fixtures.js"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import test from 'ava';
|
|
2
|
+
import forEach from 'lodash/forEach';
|
|
3
|
+
import renderComponentMacro from '../../../test/helpers/render-component';
|
|
4
|
+
import MoleculeQuickAccessCardsGroup from '..';
|
|
5
|
+
import fixtureDefault from './fixtures/default';
|
|
6
|
+
import fixtureLoading from './fixtures/loading';
|
|
7
|
+
import fixtureOneCard from './fixtures/one-card';
|
|
8
|
+
import fixtureThreeCards from './fixtures/three-cards';
|
|
9
|
+
import fixtureTwoCards from './fixtures/two-cards';
|
|
10
|
+
test('Molecule › MoleculeQuickAccessCardsGroup > should have valid propTypes', t => {
|
|
11
|
+
t.pass();
|
|
12
|
+
forEach(MoleculeQuickAccessCardsGroup.propTypes, (value, key) => {
|
|
13
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculeQuickAccessCardsGroup.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
test('Molecule › MoleculeQuickAccessCardsGroup › Default › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureDefault);
|
|
17
|
+
test('Molecule › MoleculeQuickAccessCardsGroup › Loading › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureLoading);
|
|
18
|
+
test('Molecule › MoleculeQuickAccessCardsGroup › OneCard › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureOneCard);
|
|
19
|
+
test('Molecule › MoleculeQuickAccessCardsGroup › ThreeCards › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureThreeCards);
|
|
20
|
+
test('Molecule › MoleculeQuickAccessCardsGroup › TwoCards › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureTwoCards);
|
|
21
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/quick-access-cards-group/test/fixtures.js"],"names":["test","forEach","renderComponentMacro","MoleculeQuickAccessCardsGroup","fixtureDefault","fixtureLoading","fixtureOneCard","fixtureThreeCards","fixtureTwoCards","t","pass","propTypes","value","key","not","undefined"],"mappings":"AAAA,OAAOA,IAAP,MAAiB,KAAjB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,oBAAP,MAAiC,wCAAjC;AACA,OAAOC,6BAAP,MAA0C,IAA1C;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,OAAOC,iBAAP,MAA8B,wBAA9B;AACA,OAAOC,eAAP,MAA4B,sBAA5B;AAEAR,IAAI,CAAC,wEAAD,EAA2ES,CAAC,IAAI;AAClFA,EAAAA,CAAC,CAACC,IAAF;AACAT,EAAAA,OAAO,CAACE,6BAA6B,CAACQ,SAA/B,EAA0C,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC/DJ,IAAAA,CAAC,CAACK,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,kEAAiEF,GAAI,mEAA9F;AACD,GAFM,CAAP;AAGD,CALG,CAAJ;AAOAb,IAAI,CAAC,yEAAD,EAA4EE,oBAA5E,EAAkGC,6BAAlG,EAAiIC,cAAjI,CAAJ;AACAJ,IAAI,CAAC,yEAAD,EAA4EE,oBAA5E,EAAkGC,6BAAlG,EAAiIE,cAAjI,CAAJ;AACAL,IAAI,CAAC,yEAAD,EAA4EE,oBAA5E,EAAkGC,6BAAlG,EAAiIG,cAAjI,CAAJ;AACAN,IAAI,CAAC,4EAAD,EAA+EE,oBAA/E,EAAqGC,6BAArG,EAAoII,iBAApI,CAAJ;AACAP,IAAI,CAAC,0EAAD,EAA6EE,oBAA7E,EAAmGC,6BAAnG,EAAkIK,eAAlI,CAAJ","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeQuickAccessCardsGroup from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureLoading from './fixtures/loading';\nimport fixtureOneCard from './fixtures/one-card';\nimport fixtureThreeCards from './fixtures/three-cards';\nimport fixtureTwoCards from './fixtures/two-cards';\n\ntest('Molecule › MoleculeQuickAccessCardsGroup > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeQuickAccessCardsGroup.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeQuickAccessCardsGroup.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeQuickAccessCardsGroup › Default › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureDefault);\ntest('Molecule › MoleculeQuickAccessCardsGroup › Loading › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureLoading);\ntest('Molecule › MoleculeQuickAccessCardsGroup › OneCard › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureOneCard);\ntest('Molecule › MoleculeQuickAccessCardsGroup › ThreeCards › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureThreeCards);\ntest('Molecule › MoleculeQuickAccessCardsGroup › TwoCards › should be rendered', renderComponentMacro, MoleculeQuickAccessCardsGroup, fixtureTwoCards);\n"],"file":"fixtures.js"}
|
|
@@ -7,9 +7,7 @@ import _map from "lodash/fp/map";
|
|
|
7
7
|
|
|
8
8
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import React from 'react';
|
|
10
|
+
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
|
13
11
|
import PropTypes from 'prop-types';
|
|
14
12
|
import classnames from 'classnames';
|
|
15
13
|
import { NovaCompositionNavigationArrowDown as ArrowDown } from '@coorpacademy/nova-icons';
|
|
@@ -22,155 +20,124 @@ const themeStyle = {
|
|
|
22
20
|
cockpit: style.cockpit,
|
|
23
21
|
sidebar: style.sidebar
|
|
24
22
|
};
|
|
23
|
+
export const useChoices = options => {
|
|
24
|
+
const choicesRef = useRef(options);
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_defineProperty(this, "handleOnClick", e => {
|
|
31
|
-
const {
|
|
32
|
-
opened
|
|
33
|
-
} = this.state;
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
e.stopPropagation();
|
|
36
|
-
this.setState({
|
|
37
|
-
opened: !opened
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
_defineProperty(this, "closeHandle", e => {
|
|
42
|
-
if (this.node && !this.node.contains(e.target)) {
|
|
43
|
-
this.setState({
|
|
44
|
-
opened: false
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
_defineProperty(this, "handleChange", choice => {
|
|
50
|
-
const {
|
|
51
|
-
multiple,
|
|
52
|
-
onChange
|
|
53
|
-
} = this.props; // if multiple prop is turned on
|
|
54
|
-
// we return all selected choices
|
|
55
|
-
|
|
56
|
-
if (multiple) {
|
|
57
|
-
this.choices = choice;
|
|
58
|
-
return onChange(this.choices);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return onChange(choice);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
this.state = {
|
|
65
|
-
opened: false
|
|
66
|
-
};
|
|
67
|
-
this.node = null;
|
|
26
|
+
const getChoices = () => {
|
|
27
|
+
return choicesRef.current;
|
|
28
|
+
};
|
|
68
29
|
|
|
69
|
-
|
|
70
|
-
|
|
30
|
+
const setChoices = choice => {
|
|
31
|
+
const choices = _set(`[${choice.i}].selected`, !choice.selected, getChoices());
|
|
71
32
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
document.addEventListener('click', this.closeHandle);
|
|
75
|
-
document.addEventListener('touchstart', this.closeHandle);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
33
|
+
choicesRef.current = choices.filter(c => c.selected);
|
|
34
|
+
};
|
|
78
35
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
36
|
+
return [getChoices, setChoices];
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const SelectMultiple = ({
|
|
40
|
+
title,
|
|
41
|
+
options,
|
|
42
|
+
theme,
|
|
43
|
+
placeholder,
|
|
44
|
+
description,
|
|
45
|
+
multiple,
|
|
46
|
+
onChange,
|
|
47
|
+
modified = false,
|
|
48
|
+
required = false,
|
|
49
|
+
error = false
|
|
50
|
+
}, {
|
|
51
|
+
skin
|
|
52
|
+
}) => {
|
|
53
|
+
const [isOpened, updateIsOpened] = useState(false);
|
|
54
|
+
const [getChoices, setChoices] = useChoices(options);
|
|
55
|
+
const nodeRef = useRef(null);
|
|
56
|
+
|
|
57
|
+
const defaultColor = _get('common.primary', skin);
|
|
58
|
+
|
|
59
|
+
const black = _get('common.black', skin);
|
|
60
|
+
|
|
61
|
+
const handleOnClick = useCallback(e => {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
updateIsOpened(prev => !prev);
|
|
65
|
+
}, []);
|
|
66
|
+
const closeHandle = useCallback(e => {
|
|
67
|
+
if (nodeRef && nodeRef.current && !nodeRef.current.contains(e.target)) {
|
|
68
|
+
updateIsOpened(false);
|
|
83
69
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
className: style.select,
|
|
152
|
-
title: selection || placeholder,
|
|
153
|
-
onClick: this.handleOnClick
|
|
154
|
-
}, selection || placeholder, /*#__PURE__*/React.createElement(ArrowDown, {
|
|
155
|
-
color: black,
|
|
156
|
-
className: classnames(style.arrow, {
|
|
157
|
-
[style.down]: isActive
|
|
158
|
-
})
|
|
159
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
160
|
-
className: isActive ? style.activeChoices : style.choices
|
|
161
|
-
}, /*#__PURE__*/React.createElement("ul", {
|
|
162
|
-
className: style.list
|
|
163
|
-
}, lines))), /*#__PURE__*/React.createElement("div", {
|
|
164
|
-
className: style.description
|
|
165
|
-
}, description));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
_defineProperty(SelectMultiple, "contextTypes", {
|
|
171
|
-
skin: Provider.childContextTypes.skin
|
|
172
|
-
});
|
|
70
|
+
}, []);
|
|
71
|
+
const handleChange = useCallback(choice => {
|
|
72
|
+
// if multiple prop is turned on
|
|
73
|
+
// we return all selected choices
|
|
74
|
+
if (multiple) {
|
|
75
|
+
setChoices(choice);
|
|
76
|
+
return onChange(getChoices());
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return onChange(choice);
|
|
80
|
+
}, [setChoices, multiple, onChange]);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
document.addEventListener('click', closeHandle);
|
|
83
|
+
document.addEventListener('touchstart', closeHandle);
|
|
84
|
+
return () => {
|
|
85
|
+
document.removeEventListener('click', closeHandle);
|
|
86
|
+
document.removeEventListener('touchstart', closeHandle);
|
|
87
|
+
};
|
|
88
|
+
}, [closeHandle]);
|
|
89
|
+
|
|
90
|
+
const lines = _map.convert({
|
|
91
|
+
cap: false
|
|
92
|
+
})((choice, i) => {
|
|
93
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
94
|
+
key: i,
|
|
95
|
+
className: style.choice
|
|
96
|
+
}, /*#__PURE__*/React.createElement(TitledCheckbox, {
|
|
97
|
+
onToggle: handleChange,
|
|
98
|
+
choice: _extends(_extends({}, choice), {}, {
|
|
99
|
+
i
|
|
100
|
+
}),
|
|
101
|
+
background: defaultColor
|
|
102
|
+
}));
|
|
103
|
+
}, options);
|
|
104
|
+
|
|
105
|
+
const selection = _pipe(_filter({
|
|
106
|
+
selected: true
|
|
107
|
+
}), _map('name'), _join(', '))(options);
|
|
108
|
+
|
|
109
|
+
const _title = title && `${title}${required ? ' *' : ''}`;
|
|
110
|
+
|
|
111
|
+
const titleView = title ? /*#__PURE__*/React.createElement("span", {
|
|
112
|
+
className: style.title
|
|
113
|
+
}, _title, " ") : null;
|
|
114
|
+
const isActive = isOpened === true;
|
|
115
|
+
const mainClass = theme ? themeStyle[theme] : style.default;
|
|
116
|
+
const behaviourClassName = getClassState(style.default, style.modified, style.error, modified, error);
|
|
117
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
118
|
+
className: classnames(mainClass, behaviourClassName),
|
|
119
|
+
ref: nodeRef
|
|
120
|
+
}, /*#__PURE__*/React.createElement("label", null, titleView, /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
className: style.select,
|
|
122
|
+
title: selection || placeholder,
|
|
123
|
+
onClick: handleOnClick
|
|
124
|
+
}, selection || placeholder, /*#__PURE__*/React.createElement(ArrowDown, {
|
|
125
|
+
color: black,
|
|
126
|
+
className: classnames(style.arrow, {
|
|
127
|
+
[style.down]: isActive
|
|
128
|
+
})
|
|
129
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
130
|
+
className: isActive ? style.activeChoices : style.choices
|
|
131
|
+
}, /*#__PURE__*/React.createElement("ul", {
|
|
132
|
+
className: style.list
|
|
133
|
+
}, lines))), /*#__PURE__*/React.createElement("div", {
|
|
134
|
+
className: style.description
|
|
135
|
+
}, description));
|
|
136
|
+
};
|
|
173
137
|
|
|
138
|
+
SelectMultiple.contextTypes = {
|
|
139
|
+
skin: Provider.childContextTypes.skin
|
|
140
|
+
};
|
|
174
141
|
SelectMultiple.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
175
142
|
title: PropTypes.string,
|
|
176
143
|
placeholder: PropTypes.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/molecule/select-multiple/index.js"],"names":["React","PropTypes","classnames","NovaCompositionNavigationArrowDown","ArrowDown","TitledCheckbox","Provider","getClassState","style","themeStyle","setup","cockpit","sidebar","SelectMultiple","Component","constructor","props","e","opened","state","preventDefault","stopPropagation","setState","node","contains","target","choice","multiple","onChange","choices","setNode","el","componentDidMount","document","addEventListener","closeHandle","componentWillUnmount","removeEventListener","i","selected","_choices","filter","c","render","skin","context","defaultColor","black","title","options","theme","placeholder","description","modified","required","error","lines","convert","cap","handleChange","selection","_title","titleView","isActive","mainClass","default","behaviourClassName","select","handleOnClick","arrow","down","activeChoices","list","childContextTypes","propTypes","string","arrayOf","func","bool"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAAQC,kCAAkC,IAAIC,SAA9C,QAA8D,0BAA9D;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,UAAU,GAAG;AACjBC,EAAAA,KAAK,EAAEF,KAAK,CAACE,KADI;AAEjBC,EAAAA,OAAO,EAAEH,KAAK,CAACG,OAFE;AAGjBC,EAAAA,OAAO,EAAEJ,KAAK,CAACI;AAHE,CAAnB;;AAMA,MAAMC,cAAN,SAA6Bb,KAAK,CAACc,SAAnC,CAA6C;AAkB3CC,EAAAA,WAAW,CAACC,KAAD,EAAQ;AACjB,UAAMA,KAAN;;AADiB,2CAwBHC,CAAC,IAAI;AACnB,YAAM;AAACC,QAAAA;AAAD,UAAW,KAAKC,KAAtB;AACAF,MAAAA,CAAC,CAACG,cAAF;AACAH,MAAAA,CAAC,CAACI,eAAF;AAEA,WAAKC,QAAL,CAAc;AAACJ,QAAAA,MAAM,EAAE,CAACA;AAAV,OAAd;AACD,KA9BkB;;AAAA,yCAgCLD,CAAC,IAAI;AACjB,UAAI,KAAKM,IAAL,IAAa,CAAC,KAAKA,IAAL,CAAUC,QAAV,CAAmBP,CAAC,CA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sBD;;AAjJ0C;;gBAAvCvC,c,kBAckB;AACpB+B,EAAAA,IAAI,EAAEtC,QAAQ,CAACmE,iBAAT,CAA2B7B;AADb,C;;AAdlB/B,c,CACG6D,S,2CAAY;AACjB1B,EAAAA,KAAK,EAAE/C,SAAS,CAAC0E,MADA;AAEjBxB,EAAAA,WAAW,EAAElD,SAAS,CAAC0E,MAFN;AAGjBvB,EAAAA,WAAW,EAAEnD,SAAS,CAAC0E,MAHN;AAIjB1B,EAAAA,OAAO,EAAEhD,SAAS,CAAC2E,OAAV,CAAkBvE,cAAc,CAACqE,SAAf,CAAyBhD,MAA3C,CAJQ;AAKjBE,EAAAA,QAAQ,EAAE3B,SAAS,CAAC4E,IALH;AAMjBlD,EAAAA,QAAQ,EAAE1B,SAAS,CAAC6E,IANH;AAOjB5B,EAAAA,KAAK,EAAEjD,SAAS,CAAC0E,MAPA;AAQjBtB,EAAAA,QAAQ,EAAEpD,SAAS,CAAC6E,IARH;AASjBxB,EAAAA,QAAQ,EAAErD,SAAS,CAAC6E,IATH;AAUjBvB,EAAAA,KAAK,EAAEtD,SAAS,CAAC6E;AAVA,C;AAmJrB,eAAejE,cAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {map, pipe, join, filter, get, set} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport TitledCheckbox from '../titled-checkbox';\nimport Provider from '../../atom/provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n setup: style.setup,\n cockpit: style.cockpit,\n sidebar: style.sidebar\n};\n\nclass SelectMultiple extends React.Component {\n static propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n description: PropTypes.string,\n options: PropTypes.arrayOf(TitledCheckbox.propTypes.choice),\n onChange: PropTypes.func,\n multiple: PropTypes.bool,\n theme: PropTypes.string,\n modified: PropTypes.bool,\n required: PropTypes.bool,\n error: PropTypes.bool\n };\n\n static contextTypes = {\n skin: Provider.childContextTypes.skin\n };\n\n constructor(props) {\n super(props);\n this.state = {\n opened: false\n };\n\n this.node = null;\n this.setNode = el => (this.node = el);\n }\n\n componentDidMount() {\n if (typeof document !== 'undefined') {\n document.addEventListener('click', this.closeHandle);\n document.addEventListener('touchstart', this.closeHandle);\n }\n }\n\n componentWillUnmount() {\n if (typeof document !== 'undefined') {\n document.removeEventListener('click', this.closeHandle);\n document.removeEventListener('touchstart', this.closeHandle);\n }\n }\n\n handleOnClick = e => {\n const {opened} = this.state;\n e.preventDefault();\n e.stopPropagation();\n\n this.setState({opened: !opened});\n };\n\n closeHandle = e => {\n if (this.node && !this.node.contains(e.target)) {\n this.setState({opened: false});\n }\n };\n\n set choices(choice) {\n const choices = set(`[${choice.i}].selected`, !choice.selected, this._choices);\n\n this._choices = choices.filter(c => c.selected);\n }\n\n get choices() {\n return this._choices;\n }\n\n handleChange = choice => {\n const {multiple, onChange} = this.props;\n // if multiple prop is turned on\n // we return all selected choices\n if (multiple) {\n this.choices = choice;\n\n return onChange(this.choices);\n }\n\n return onChange(choice);\n };\n\n render() {\n const {skin} = this.context;\n const defaultColor = get('common.primary', skin);\n const black = get('common.black', skin);\n const {\n title,\n options,\n theme,\n placeholder,\n description,\n modified = false,\n required = false,\n error = false\n } = this.props;\n const {opened} = this.state;\n\n this._choices = options;\n\n const lines = map.convert({cap: false})((choice, i) => {\n return (\n <li key={i} className={style.choice}>\n <TitledCheckbox\n onToggle={this.handleChange}\n choice={{...choice, i}}\n background={defaultColor}\n />\n </li>\n );\n }, options);\n const selection = pipe(filter({selected: true}), map('name'), join(', '))(options);\n\n const _title = title && `${title}${required ? ' *' : ''}`;\n\n const titleView = title ? <span className={style.title}>{_title} </span> : null;\n const isActive = opened === true;\n const mainClass = theme ? themeStyle[theme] : style.default;\n const behaviourClassName = getClassState(\n style.default,\n style.modified,\n style.error,\n modified,\n error\n );\n\n return (\n <div className={classnames(mainClass, behaviourClassName)} ref={this.setNode}>\n <label>\n {titleView}\n <div\n className={style.select}\n title={selection || placeholder}\n onClick={this.handleOnClick}\n >\n {selection || placeholder}\n <ArrowDown\n color={black}\n className={classnames(style.arrow, {[style.down]: isActive})}\n />\n </div>\n <div className={isActive ? style.activeChoices : style.choices}>\n <ul className={style.list}>{lines}</ul>\n </div>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n }\n}\n\nexport default SelectMultiple;\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/molecule/select-multiple/index.js"],"names":["React","useState","useEffect","useRef","useCallback","PropTypes","classnames","NovaCompositionNavigationArrowDown","ArrowDown","TitledCheckbox","Provider","getClassState","style","themeStyle","setup","cockpit","sidebar","useChoices","options","choicesRef","getChoices","current","setChoices","choice","choices","i","selected","filter","c","SelectMultiple","title","theme","placeholder","description","multiple","onChange","modified","required","error","skin","isOpened","updateIsOpened","nodeRef","defaultColor","black","handleOnClick","e","preventDefault","stopPropagation","prev","closeHandle","contains","target","handleChange","document","addEventListener","removeEventListener","lines","convert","cap","selection","_title","titleView","isActive","mainClass","default","behaviourClassName","select","arrow","down","activeChoices","list","contextTypes","childContextTypes","propTypes","string","arrayOf","func","bool"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,SAAzB,EAAoCC,MAApC,EAA4CC,WAA5C,QAA8D,OAA9D;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,SAAQC,kCAAkC,IAAIC,SAA9C,QAA8D,0BAA9D;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,QAAP,MAAqB,qBAArB;AACA,OAAOC,aAAP,MAA0B,4BAA1B;AACA,OAAOC,KAAP,MAAkB,aAAlB;AAEA,MAAMC,UAAU,GAAG;AACjBC,EAAAA,KAAK,EAAEF,KAAK,CAACE,KADI;AAEjBC,EAAAA,OAAO,EAAEH,KAAK,CAACG,OAFE;AAGjBC,E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ffect, useRef, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport {map, pipe, join, filter, get, set} from 'lodash/fp';\nimport {NovaCompositionNavigationArrowDown as ArrowDown} from '@coorpacademy/nova-icons';\nimport TitledCheckbox from '../titled-checkbox';\nimport Provider from '../../atom/provider';\nimport getClassState from '../../util/get-class-state';\nimport style from './style.css';\n\nconst themeStyle = {\n setup: style.setup,\n cockpit: style.cockpit,\n sidebar: style.sidebar\n};\n\nexport const useChoices = options => {\n const choicesRef = useRef(options);\n\n const getChoices = () => {\n return choicesRef.current;\n };\n\n const setChoices = choice => {\n const choices = set(`[${choice.i}].selected`, !choice.selected, getChoices());\n\n choicesRef.current = choices.filter(c => c.selected);\n };\n\n return [getChoices, setChoices];\n};\n\nconst SelectMultiple = (\n {\n title,\n options,\n theme,\n placeholder,\n description,\n multiple,\n onChange,\n modified = false,\n required = false,\n error = false\n },\n {skin}\n) => {\n const [isOpened, updateIsOpened] = useState(false);\n const [getChoices, setChoices] = useChoices(options);\n const nodeRef = useRef(null);\n\n const defaultColor = get('common.primary', skin);\n const black = get('common.black', skin);\n\n const handleOnClick = useCallback(e => {\n e.preventDefault();\n e.stopPropagation();\n\n updateIsOpened(prev => !prev);\n }, []);\n\n const closeHandle = useCallback(e => {\n if (nodeRef && nodeRef.current && !nodeRef.current.contains(e.target)) {\n updateIsOpened(false);\n }\n }, []);\n\n const handleChange = useCallback(\n choice => {\n // if multiple prop is turned on\n // we return all selected choices\n if (multiple) {\n setChoices(choice);\n\n return onChange(getChoices());\n }\n\n return onChange(choice);\n },\n [setChoices, multiple, onChange]\n );\n\n useEffect(() => {\n document.addEventListener('click', closeHandle);\n document.addEventListener('touchstart', closeHandle);\n\n return () => {\n document.removeEventListener('click', closeHandle);\n document.removeEventListener('touchstart', closeHandle);\n };\n }, [closeHandle]);\n\n const lines = map.convert({cap: false})((choice, i) => {\n return (\n <li key={i} className={style.choice}>\n <TitledCheckbox onToggle={handleChange} choice={{...choice, i}} background={defaultColor} />\n </li>\n );\n }, options);\n\n const selection = pipe(filter({selected: true}), map('name'), join(', '))(options);\n\n const _title = title && `${title}${required ? ' *' : ''}`;\n\n const titleView = title ? <span className={style.title}>{_title} </span> : null;\n const isActive = isOpened === true;\n const mainClass = theme ? themeStyle[theme] : style.default;\n const behaviourClassName = getClassState(\n style.default,\n style.modified,\n style.error,\n modified,\n error\n );\n\n return (\n <div className={classnames(mainClass, behaviourClassName)} ref={nodeRef}>\n <label>\n {titleView}\n <div className={style.select} title={selection || placeholder} onClick={handleOnClick}>\n {selection || placeholder}\n <ArrowDown color={black} className={classnames(style.arrow, {[style.down]: isActive})} />\n </div>\n <div className={isActive ? style.activeChoices : style.choices}>\n <ul className={style.list}>{lines}</ul>\n </div>\n </label>\n <div className={style.description}>{description}</div>\n </div>\n );\n};\n\nSelectMultiple.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nSelectMultiple.propTypes = {\n title: PropTypes.string,\n placeholder: PropTypes.string,\n description: PropTypes.string,\n options: PropTypes.arrayOf(TitledCheckbox.propTypes.choice),\n onChange: PropTypes.func,\n multiple: PropTypes.bool,\n theme: PropTypes.string,\n modified: PropTypes.bool,\n required: PropTypes.bool,\n error: PropTypes.bool\n};\n\nexport default SelectMultiple;\n"],"file":"index.js"}
|
|
@@ -2,58 +2,29 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import browserEnv from 'browser-env';
|
|
4
4
|
import test from 'ava';
|
|
5
|
+
import flatten from 'lodash/fp/flatten';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import { mount, configure } from 'enzyme';
|
|
7
8
|
import Adapter from 'enzyme-adapter-react-16';
|
|
8
|
-
import SelectMultiple from '..';
|
|
9
|
+
import SelectMultiple, { useChoices } from '..';
|
|
9
10
|
import defaultFixture from './fixtures/checked';
|
|
10
11
|
browserEnv();
|
|
11
12
|
configure({
|
|
12
13
|
adapter: new Adapter()
|
|
13
14
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const wrapper = mount( /*#__PURE__*/React.createElement(SelectMultiple, props));
|
|
22
|
-
const selectWrapper = wrapper.find('.select-multiple__select');
|
|
23
|
-
t.is(wrapper.state().opened, false);
|
|
24
|
-
t.is(selectWrapper.exists(), true);
|
|
25
|
-
selectWrapper.simulate('click', clickEvent);
|
|
26
|
-
t.is(wrapper.state().opened, true);
|
|
27
|
-
selectWrapper.simulate('click', clickEvent);
|
|
28
|
-
t.is(wrapper.state().opened, false);
|
|
29
|
-
});
|
|
30
|
-
test('should select choice', t => {
|
|
31
|
-
t.plan(8);
|
|
32
|
-
const clickEvent = {
|
|
33
|
-
preventDefault: () => t.pass(),
|
|
34
|
-
stopPropagation: () => t.pass()
|
|
15
|
+
|
|
16
|
+
const setup = options => {
|
|
17
|
+
const returnVal = [];
|
|
18
|
+
|
|
19
|
+
const TestComponent = () => {
|
|
20
|
+
returnVal.push(useChoices(options));
|
|
21
|
+
return null;
|
|
35
22
|
};
|
|
36
23
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
t.pass();
|
|
41
|
-
}
|
|
42
|
-
});
|
|
24
|
+
mount( /*#__PURE__*/React.createElement(TestComponent, null));
|
|
25
|
+
return flatten(returnVal);
|
|
26
|
+
};
|
|
43
27
|
|
|
44
|
-
const wrapper = mount( /*#__PURE__*/React.createElement(SelectMultiple, props));
|
|
45
|
-
const selectWrapper = wrapper.find('.select-multiple__select');
|
|
46
|
-
wrapper.update();
|
|
47
|
-
t.is(wrapper.state().opened, false);
|
|
48
|
-
t.is(selectWrapper.exists(), true);
|
|
49
|
-
selectWrapper.simulate('click', clickEvent);
|
|
50
|
-
wrapper.update();
|
|
51
|
-
t.is(wrapper.state().opened, true);
|
|
52
|
-
const checkbox = wrapper.find('[checked=false]').first();
|
|
53
|
-
checkbox.simulate('change');
|
|
54
|
-
t.is(wrapper.state().opened, true);
|
|
55
|
-
wrapper.update();
|
|
56
|
-
});
|
|
57
28
|
test('should select array of choices when props.multiple is set', t => {
|
|
58
29
|
t.plan(2);
|
|
59
30
|
|
|
@@ -72,51 +43,21 @@ test('should select array of choices when props.multiple is set', t => {
|
|
|
72
43
|
props
|
|
73
44
|
});
|
|
74
45
|
});
|
|
75
|
-
test('should click outside', t => {
|
|
76
|
-
t.plan(10);
|
|
77
|
-
const clickEvent = {
|
|
78
|
-
preventDefault: () => t.pass(),
|
|
79
|
-
stopPropagation: () => t.pass()
|
|
80
|
-
};
|
|
81
|
-
const props = defaultFixture.props;
|
|
82
|
-
const wrapper = mount( /*#__PURE__*/React.createElement(SelectMultiple, props));
|
|
83
|
-
const selectWrapper = wrapper.find('.select-multiple__select');
|
|
84
|
-
const instance = wrapper.instance();
|
|
85
|
-
wrapper.update();
|
|
86
|
-
t.is(wrapper.state().opened, false);
|
|
87
|
-
t.is(selectWrapper.exists(), true);
|
|
88
|
-
selectWrapper.simulate('click', clickEvent);
|
|
89
|
-
wrapper.update();
|
|
90
|
-
t.is(wrapper.state().opened, true);
|
|
91
|
-
instance.closeHandle({
|
|
92
|
-
target: null
|
|
93
|
-
});
|
|
94
|
-
t.is(wrapper.state().opened, false);
|
|
95
|
-
selectWrapper.simulate('click', clickEvent);
|
|
96
|
-
wrapper.update();
|
|
97
|
-
t.is(wrapper.state().opened, true);
|
|
98
|
-
instance.closeHandle({
|
|
99
|
-
target: selectWrapper.getDOMNode()
|
|
100
|
-
});
|
|
101
|
-
t.is(wrapper.state().opened, true);
|
|
102
|
-
wrapper.update();
|
|
103
|
-
wrapper.unmount();
|
|
104
|
-
});
|
|
105
46
|
test('should return choices (getter)', t => {
|
|
106
47
|
const props = _extends({}, defaultFixture.props);
|
|
107
48
|
|
|
108
|
-
const
|
|
109
|
-
t.is(
|
|
49
|
+
const [getChoices] = setup(props.options);
|
|
50
|
+
t.is(getChoices().length, 4, 'not returning expected choices');
|
|
110
51
|
});
|
|
111
52
|
test('should set current choice (setter)', t => {
|
|
112
53
|
const props = _extends({}, defaultFixture.props);
|
|
113
54
|
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
t.is(
|
|
117
|
-
|
|
55
|
+
const [getChoices, setChoices] = setup(props.options);
|
|
56
|
+
const choices = getChoices();
|
|
57
|
+
t.is(choices[0].selected, false, 'not setting correctly expected value for choice[0]');
|
|
58
|
+
setChoices(_extends(_extends({}, props.options[0]), {}, {
|
|
118
59
|
i: 0
|
|
119
|
-
});
|
|
120
|
-
t.is(
|
|
60
|
+
}));
|
|
61
|
+
t.is(getChoices()[0].selected, true, 'not updating correctly expected value for choice[0]');
|
|
121
62
|
});
|
|
122
63
|
//# sourceMappingURL=index.js.map
|