@coorpacademy/components 10.5.7-alpha.6.5 → 10.5.7-alpha.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/select/index.js +38 -20
- package/es/atom/select/index.js.map +1 -1
- package/es/atom/select/style.css +154 -42
- package/es/atom/select/test/fixtures/player.js +11 -0
- package/es/atom/select/test/fixtures/player.js.map +1 -0
- package/es/atom/select/test/fixtures.js +2 -0
- package/es/atom/select/test/fixtures.js.map +1 -1
- package/es/atom/select/test/select.js +49 -0
- package/es/atom/select/test/select.js.map +1 -0
- package/es/molecule/course-sections/test/fixtures.js +15 -0
- package/es/molecule/course-sections/test/fixtures.js.map +1 -0
- package/es/molecule/draggable-list/test/fixtures.js +15 -0
- package/es/molecule/draggable-list/test/fixtures.js.map +1 -0
- package/es/molecule/questions/drop-down/index.js +1 -6
- package/es/molecule/questions/drop-down/index.js.map +1 -1
- package/es/molecule/questions/free-text/index.js +35 -15
- package/es/molecule/questions/free-text/index.js.map +1 -1
- package/es/molecule/questions/free-text/style.css +39 -15
- package/es/molecule/questions/free-text/test/fixtures/default.js +1 -1
- package/es/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
- package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js +9 -0
- package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +1 -0
- package/es/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js} +2 -2
- package/es/molecule/questions/free-text/test/fixtures/with-value.js.map +1 -0
- package/es/molecule/questions/free-text/test/fixtures.js +4 -2
- package/es/molecule/questions/free-text/test/fixtures.js.map +1 -1
- package/es/molecule/questions/free-text/test/free-text.js +106 -0
- package/es/molecule/questions/free-text/test/free-text.js.map +1 -0
- package/es/molecule/questions/qcm/style.css +4 -0
- package/es/molecule/questions/qcm-drag/index.js +53 -21
- package/es/molecule/questions/qcm-drag/index.js.map +1 -1
- package/es/molecule/questions/qcm-drag/style.css +73 -22
- package/es/molecule/questions/qcm-graphic/index.js +1 -0
- package/es/molecule/questions/qcm-graphic/index.js.map +1 -1
- package/es/molecule/questions/qcm-graphic/style.css +12 -0
- package/es/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
- package/es/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
- package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
- package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
- package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
- package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
- package/es/molecule/questions/template/index.js +13 -10
- package/es/molecule/questions/template/index.js.map +1 -1
- package/es/molecule/wizard-summary/test/fixtures.js +2 -0
- package/es/molecule/wizard-summary/test/fixtures.js.map +1 -1
- package/es/organism/wizard-contents/test/fixtures.js +2 -0
- package/es/organism/wizard-contents/test/fixtures.js.map +1 -1
- 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/lib/atom/select/index.js +40 -17
- package/lib/atom/select/index.js.map +1 -1
- package/lib/atom/select/style.css +154 -42
- package/lib/atom/select/test/fixtures/player.js +21 -0
- package/lib/atom/select/test/fixtures/player.js.map +1 -0
- package/lib/atom/select/test/fixtures.js +3 -0
- package/lib/atom/select/test/fixtures.js.map +1 -1
- package/lib/atom/select/test/select.js +62 -0
- package/lib/atom/select/test/select.js.map +1 -0
- package/lib/molecule/course-sections/test/fixtures.js +25 -0
- package/lib/molecule/course-sections/test/fixtures.js.map +1 -0
- package/lib/molecule/draggable-list/test/fixtures.js +25 -0
- package/lib/molecule/draggable-list/test/fixtures.js.map +1 -0
- package/lib/molecule/questions/drop-down/index.js +1 -5
- package/lib/molecule/questions/drop-down/index.js.map +1 -1
- package/lib/molecule/questions/free-text/index.js +32 -14
- package/lib/molecule/questions/free-text/index.js.map +1 -1
- package/lib/molecule/questions/free-text/style.css +39 -15
- package/lib/molecule/questions/free-text/test/fixtures/default.js +1 -1
- package/lib/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
- package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js +14 -0
- package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +1 -0
- package/lib/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js} +2 -2
- package/lib/molecule/questions/free-text/test/fixtures/with-value.js.map +1 -0
- package/lib/molecule/questions/free-text/test/fixtures.js +5 -2
- package/lib/molecule/questions/free-text/test/fixtures.js.map +1 -1
- package/lib/molecule/questions/free-text/test/free-text.js +119 -0
- package/lib/molecule/questions/free-text/test/free-text.js.map +1 -0
- package/lib/molecule/questions/qcm/style.css +4 -0
- package/lib/molecule/questions/qcm-drag/index.js +53 -21
- package/lib/molecule/questions/qcm-drag/index.js.map +1 -1
- package/lib/molecule/questions/qcm-drag/style.css +73 -22
- package/lib/molecule/questions/qcm-graphic/index.js +1 -0
- package/lib/molecule/questions/qcm-graphic/index.js.map +1 -1
- package/lib/molecule/questions/qcm-graphic/style.css +12 -0
- package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
- package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
- package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
- package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
- package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
- package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
- package/lib/molecule/questions/template/index.js +13 -10
- package/lib/molecule/questions/template/index.js.map +1 -1
- package/lib/molecule/wizard-summary/test/fixtures.js +3 -0
- package/lib/molecule/wizard-summary/test/fixtures.js.map +1 -1
- package/lib/organism/wizard-contents/test/fixtures.js +3 -0
- package/lib/organism/wizard-contents/test/fixtures.js.map +1 -1
- 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/package.json +2 -2
- package/es/molecule/cockpit-popin/test/fixtures.js +0 -17
- package/es/molecule/cockpit-popin/test/fixtures.js.map +0 -1
- package/es/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
- package/es/molecule/search/test/fixtures.js +0 -15
- package/es/molecule/search/test/fixtures.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
- package/lib/molecule/questions/free-text/test/fixtures/with-default-value.js.map +0 -1
- package/lib/molecule/search/test/fixtures.js +0 -25
- package/lib/molecule/search/test/fixtures.js.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _browserEnv = _interopRequireDefault(require("browser-env"));
|
|
4
|
+
|
|
5
|
+
var _ava = _interopRequireDefault(require("ava"));
|
|
6
|
+
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
|
|
9
|
+
var _enzyme = require("enzyme");
|
|
10
|
+
|
|
11
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/fp/cloneDeep"));
|
|
12
|
+
|
|
13
|
+
var _noop = _interopRequireDefault(require("lodash/fp/noop"));
|
|
14
|
+
|
|
15
|
+
var _enzymeAdapterReact = _interopRequireDefault(require("enzyme-adapter-react-16"));
|
|
16
|
+
|
|
17
|
+
var _ = _interopRequireDefault(require(".."));
|
|
18
|
+
|
|
19
|
+
var _player = _interopRequireDefault(require("./fixtures/player"));
|
|
20
|
+
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
|
|
23
|
+
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); }
|
|
24
|
+
|
|
25
|
+
(0, _browserEnv.default)();
|
|
26
|
+
(0, _enzyme.configure)({
|
|
27
|
+
adapter: new _enzymeAdapterReact.default()
|
|
28
|
+
});
|
|
29
|
+
(0, _ava.default)('classnames: should pass the styles pertinent to a player theme, text color: use skin color (selected, valid option, player)', t => {
|
|
30
|
+
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_.default, _extends({}, _player.default.props, {
|
|
31
|
+
onChange: _noop.default
|
|
32
|
+
})));
|
|
33
|
+
const selectWrapper = wrapper.find('[data-name="select-wrapper"]');
|
|
34
|
+
t.true(selectWrapper.at(0).exists()); // should use skin color
|
|
35
|
+
|
|
36
|
+
t.deepEqual(selectWrapper.at(0).props().style, {
|
|
37
|
+
color: '#00B0FF'
|
|
38
|
+
});
|
|
39
|
+
const selectSpan = selectWrapper.at(0).find('[data-name="select-span"]');
|
|
40
|
+
t.true(selectSpan.at(0).exists());
|
|
41
|
+
t.is(selectSpan.at(0).props().className, 'select__selectSpan select__noLabelCommon');
|
|
42
|
+
});
|
|
43
|
+
(0, _ava.default)('text color: should not use skin color (selected, invalid option, player), long label', t => {
|
|
44
|
+
const withInvalid = (0, _cloneDeep.default)(_player.default.props);
|
|
45
|
+
withInvalid.options[1] = {
|
|
46
|
+
name: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean.',
|
|
47
|
+
value: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean.',
|
|
48
|
+
selected: true,
|
|
49
|
+
validOption: false
|
|
50
|
+
};
|
|
51
|
+
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_.default, _extends({}, withInvalid, {
|
|
52
|
+
onChange: _noop.default
|
|
53
|
+
})));
|
|
54
|
+
const selectWrapper = wrapper.find('[data-name="select-wrapper"]');
|
|
55
|
+
t.true(selectWrapper.at(0).exists()); // should not use skin color
|
|
56
|
+
|
|
57
|
+
t.deepEqual(selectWrapper.at(0).props().style, {});
|
|
58
|
+
const selectSpan = selectWrapper.at(0).find('[data-name="select-span"]');
|
|
59
|
+
t.true(selectSpan.at(0).exists());
|
|
60
|
+
t.is(selectSpan.at(0).props().className, 'select__selectSpan select__noLabelCommon select__longLabel');
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/atom/select/test/select.js"],"names":["adapter","Adapter","t","wrapper","playerFixture","props","noop","selectWrapper","find","true","at","exists","deepEqual","style","color","selectSpan","is","className","withInvalid","options","name","value","selected","validOption"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA;AACA,uBAAU;AAACA,EAAAA,OAAO,EAAE,IAAIC,2BAAJ;AAAV,CAAV;AAEA,kBAAK,6HAAL,EAAoIC,CAAC,IAAI;AACvI,QAAMC,OAAO,GAAG,iCAAM,6BAAC,SAAD,eAAYC,gBAAcC,KAA1B;AAAiC,IAAA,QAAQ,EAAEC;AAA3C,KAAN,CAAhB;AACA,QAAMC,aAAa,GAAGJ,OAAO,CAACK,IAAR,CAAa,8BAAb,CAAtB;AACAN,EAAAA,CAAC,CAACO,IAAF,CAAOF,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBC,MAApB,EAAP,EAHuI,CAIvI;;AACAT,EAAAA,CAAC,CAACU,SAAF,CAAYL,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBL,KAApB,GAA4BQ,KAAxC,EAA+C;AAC7CC,IAAAA,KAAK,EAAE;AADsC,GAA/C;AAGA,QAAMC,UAAU,GAAGR,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBF,IAApB,CAAyB,2BAAzB,CAAnB;AACAN,EAAAA,CAAC,CAACO,IAAF,CAAOM,UAAU,CAACL,EAAX,CAAc,CAAd,EAAiBC,MAAjB,EAAP;AACAT,EAAAA,CAAC,CAACc,EAAF,CAAKD,UAAU,CAACL,EAAX,CAAc,CAAd,EAAiBL,KAAjB,GAAyBY,SAA9B,EAAyC,0CAAzC;AACD,CAXD;AAaA,kBAAK,sFAAL,EAA6Ff,CAAC,IAAI;AAChG,QAAMgB,WAAW,GAAG,wBAAUd,gBAAcC,KAAxB,CAApB;AACAa,EAAAA,WAAW,CAACC,OAAZ,CAAoB,CAApB,IAAyB;AACvBC,IAAAA,IAAI,EAAE,mEADiB;AAEvBC,IAAAA,KAAK,EAAE,mEAFgB;AAGvBC,IAAAA,QAAQ,EAAE,IAHa;AAIvBC,IAAAA,WAAW,EAAE;AAJU,GAAzB;AAMA,QAAMpB,OAAO,GAAG,iCAAM,6BAAC,SAAD,eAAYe,WAAZ;AAAyB,IAAA,QAAQ,EAAEZ;AAAnC,KAAN,CAAhB;AACA,QAAMC,aAAa,GAAGJ,OAAO,CAACK,IAAR,CAAa,8BAAb,CAAtB;AACAN,EAAAA,CAAC,CAACO,IAAF,CAAOF,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBC,MAApB,EAAP,EAVgG,CAWhG;;AACAT,EAAAA,CAAC,CAACU,SAAF,CAAYL,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBL,KAApB,GAA4BQ,KAAxC,EAA+C,EAA/C;AACA,QAAME,UAAU,GAAGR,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBF,IAApB,CAAyB,2BAAzB,CAAnB;AACAN,EAAAA,CAAC,CAACO,IAAF,CAAOM,UAAU,CAACL,EAAX,CAAc,CAAd,EAAiBC,MAAjB,EAAP;AACAT,EAAAA,CAAC,CAACc,EAAF,CACED,UAAU,CAACL,EAAX,CAAc,CAAd,EAAiBL,KAAjB,GAAyBY,SAD3B,EAEE,4DAFF;AAID,CAnBD","sourcesContent":["import browserEnv from 'browser-env';\nimport test from 'ava';\nimport React from 'react';\nimport {mount, configure} from 'enzyme';\nimport cloneDeep from 'lodash/fp/cloneDeep';\nimport noop from 'lodash/fp/noop';\nimport Adapter from 'enzyme-adapter-react-16';\nimport Select from '..';\nimport playerFixture from './fixtures/player';\n\nbrowserEnv();\nconfigure({adapter: new Adapter()});\n\ntest('classnames: should pass the styles pertinent to a player theme, text color: use skin color (selected, valid option, player)', t => {\n const wrapper = mount(<Select {...playerFixture.props} onChange={noop} />);\n const selectWrapper = wrapper.find('[data-name=\"select-wrapper\"]');\n t.true(selectWrapper.at(0).exists());\n // should use skin color\n t.deepEqual(selectWrapper.at(0).props().style, {\n color: '#00B0FF'\n });\n const selectSpan = selectWrapper.at(0).find('[data-name=\"select-span\"]');\n t.true(selectSpan.at(0).exists());\n t.is(selectSpan.at(0).props().className, 'select__selectSpan select__noLabelCommon');\n});\n\ntest('text color: should not use skin color (selected, invalid option, player), long label', t => {\n const withInvalid = cloneDeep(playerFixture.props);\n withInvalid.options[1] = {\n name: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean.',\n value: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean.',\n selected: true,\n validOption: false\n };\n const wrapper = mount(<Select {...withInvalid} onChange={noop} />);\n const selectWrapper = wrapper.find('[data-name=\"select-wrapper\"]');\n t.true(selectWrapper.at(0).exists());\n // should not use skin color\n t.deepEqual(selectWrapper.at(0).props().style, {});\n const selectSpan = selectWrapper.at(0).find('[data-name=\"select-span\"]');\n t.true(selectSpan.at(0).exists());\n t.is(\n selectSpan.at(0).props().className,\n 'select__selectSpan select__noLabelCommon select__longLabel'\n );\n});\n"],"file":"select.js"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _ava = _interopRequireDefault(require("ava"));
|
|
4
|
+
|
|
5
|
+
var _forEach = _interopRequireDefault(require("lodash/forEach"));
|
|
6
|
+
|
|
7
|
+
var _renderComponent = _interopRequireDefault(require("../../../test/helpers/render-component"));
|
|
8
|
+
|
|
9
|
+
var _ = _interopRequireDefault(require(".."));
|
|
10
|
+
|
|
11
|
+
var _default = _interopRequireDefault(require("./fixtures/default"));
|
|
12
|
+
|
|
13
|
+
var _loading = _interopRequireDefault(require("./fixtures/loading"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
(0, _ava.default)('Molecule › MoleculeCourseSections > should have valid propTypes', t => {
|
|
18
|
+
t.pass();
|
|
19
|
+
(0, _forEach.default)(_.default.propTypes, (value, key) => {
|
|
20
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculeCourseSections.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
(0, _ava.default)('Molecule › MoleculeCourseSections › Default › should be rendered', _renderComponent.default, _.default, _default.default);
|
|
24
|
+
(0, _ava.default)('Molecule › MoleculeCourseSections › Loading › should be rendered', _renderComponent.default, _.default, _loading.default);
|
|
25
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/course-sections/test/fixtures.js"],"names":["t","pass","MoleculeCourseSections","propTypes","value","key","not","undefined","renderComponentMacro","fixtureDefault","fixtureLoading"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,kBAAK,iEAAL,EAAwEA,CAAC,IAAI;AAC3EA,EAAAA,CAAC,CAACC,IAAF;AACA,wBAAQC,UAAuBC,SAA/B,EAA0C,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACxDL,IAAAA,CAAC,CAACM,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,2DAA0DF,GAAI,mEAAvF;AACD,GAFD;AAGD,CALD;AAOA,kBAAK,kEAAL,EAAyEG,wBAAzE,EAA+FN,SAA/F,EAAuHO,gBAAvH;AACA,kBAAK,kEAAL,EAAyED,wBAAzE,EAA+FN,SAA/F,EAAuHQ,gBAAvH","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeCourseSections from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureLoading from './fixtures/loading';\n\ntest('Molecule › MoleculeCourseSections > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeCourseSections.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeCourseSections.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeCourseSections › Default › should be rendered', renderComponentMacro, MoleculeCourseSections, fixtureDefault);\ntest('Molecule › MoleculeCourseSections › Loading › should be rendered', renderComponentMacro, MoleculeCourseSections, fixtureLoading);\n"],"file":"fixtures.js"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _ava = _interopRequireDefault(require("ava"));
|
|
4
|
+
|
|
5
|
+
var _forEach = _interopRequireDefault(require("lodash/forEach"));
|
|
6
|
+
|
|
7
|
+
var _renderComponent = _interopRequireDefault(require("../../../test/helpers/render-component"));
|
|
8
|
+
|
|
9
|
+
var _ = _interopRequireDefault(require(".."));
|
|
10
|
+
|
|
11
|
+
var _courseSections = _interopRequireDefault(require("./fixtures/course-sections"));
|
|
12
|
+
|
|
13
|
+
var _dashboardSections = _interopRequireDefault(require("./fixtures/dashboard-sections"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
|
|
17
|
+
(0, _ava.default)('Molecule › MoleculeDraggableList > should have valid propTypes', t => {
|
|
18
|
+
t.pass();
|
|
19
|
+
(0, _forEach.default)(_.default.propTypes, (value, key) => {
|
|
20
|
+
t.not(value, undefined, `PropType for "Molecule.MoleculeDraggableList.propTypes.${key}" may not be undefined. Did you mistype the propTypes definition?`);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
(0, _ava.default)('Molecule › MoleculeDraggableList › CourseSections › should be rendered', _renderComponent.default, _.default, _courseSections.default);
|
|
24
|
+
(0, _ava.default)('Molecule › MoleculeDraggableList › DashboardSections › should be rendered', _renderComponent.default, _.default, _dashboardSections.default);
|
|
25
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/draggable-list/test/fixtures.js"],"names":["t","pass","MoleculeDraggableList","propTypes","value","key","not","undefined","renderComponentMacro","fixtureCourseSections","fixtureDashboardSections"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,kBAAK,gEAAL,EAAuEA,CAAC,IAAI;AAC1EA,EAAAA,CAAC,CAACC,IAAF;AACA,wBAAQC,UAAsBC,SAA9B,EAAyC,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACvDL,IAAAA,CAAC,CAACM,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,0DAAyDF,GAAI,mEAAtF;AACD,GAFD;AAGD,CALD;AAOA,kBAAK,wEAAL,EAA+EG,wBAA/E,EAAqGN,SAArG,EAA4HO,uBAA5H;AACA,kBAAK,2EAAL,EAAkFD,wBAAlF,EAAwGN,SAAxG,EAA+HQ,0BAA/H","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../test/helpers/render-component';\nimport MoleculeDraggableList from '..';\nimport fixtureCourseSections from './fixtures/course-sections';\nimport fixtureDashboardSections from './fixtures/dashboard-sections';\n\ntest('Molecule › MoleculeDraggableList > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeDraggableList.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"Molecule.MoleculeDraggableList.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('Molecule › MoleculeDraggableList › CourseSections › should be rendered', renderComponentMacro, MoleculeDraggableList, fixtureCourseSections);\ntest('Molecule › MoleculeDraggableList › DashboardSections › should be rendered', renderComponentMacro, MoleculeDraggableList, fixtureDashboardSections);\n"],"file":"fixtures.js"}
|
|
@@ -19,8 +19,6 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
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); }
|
|
23
|
-
|
|
24
22
|
const DropDown = props => {
|
|
25
23
|
const {
|
|
26
24
|
options,
|
|
@@ -41,9 +39,7 @@ const DropDown = props => {
|
|
|
41
39
|
|
|
42
40
|
DropDown.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
43
41
|
onChange: _select.default.propTypes.onChange,
|
|
44
|
-
options: _propTypes.default.arrayOf(_propTypes.default.shape(
|
|
45
|
-
validOption: _propTypes.default.bool
|
|
46
|
-
}))),
|
|
42
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape(_select.SelectOptionPropTypes)),
|
|
47
43
|
theme: _select.default.propTypes.theme
|
|
48
44
|
} : {};
|
|
49
45
|
var _default = DropDown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/molecule/questions/drop-down/index.js"],"names":["DropDown","props","options","onChange","theme","propsTheme","currentSelection","defaultTheme","validOption","style","wrapper","propTypes","Select","PropTypes","arrayOf","shape","SelectOptionPropTypes"
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/questions/drop-down/index.js"],"names":["DropDown","props","options","onChange","theme","propsTheme","currentSelection","defaultTheme","validOption","style","wrapper","propTypes","Select","PropTypes","arrayOf","shape","SelectOptionPropTypes"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,QAAQ,GAAGC,KAAK,IAAI;AACxB,QAAM;AAACC,IAAAA,OAAD;AAAUC,IAAAA,QAAV;AAAoBC,IAAAA,KAAK,EAAEC;AAA3B,MAAyCJ,KAA/C;AAEA,QAAMK,gBAAgB,GAAG,oBAAK,UAAL,EAAiBJ,OAAjB,CAAzB;AACA,QAAMK,YAAY,GAChB,CAACD,gBAAD,IAAqBA,gBAAgB,CAACE,WAAjB,KAAiC,KAAtD,GAA8D,SAA9D,GAA0E,UAD5E;AAGA,QAAMJ,KAAK,GAAGC,UAAU,IAAIE,YAA5B;AAEA,sBACE;AAAK,IAAA,SAAS,EAAEE,eAAMC;AAAtB,kBACE,6BAAC,eAAD;AAAQ,IAAA,KAAK,EAAEN,KAAf;AAAsB,IAAA,OAAO,EAAEF,OAA/B;AAAwC,IAAA,QAAQ,EAAEC;AAAlD,IADF,CADF;AAKD,CAdD;;AAgBAH,QAAQ,CAACW,SAAT,2CAAqB;AACnBR,EAAAA,QAAQ,EAAES,gBAAOD,SAAP,CAAiBR,QADR;AAEnBD,EAAAA,OAAO,EAAEW,mBAAUC,OAAV,CAAkBD,mBAAUE,KAAV,CAAgBC,6BAAhB,CAAlB,CAFU;AAGnBZ,EAAAA,KAAK,EAAEQ,gBAAOD,SAAP,CAAiBP;AAHL,CAArB;eAMeJ,Q","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {find} from 'lodash/fp';\nimport Select, {SelectOptionPropTypes} from '../../../atom/select';\nimport style from './style.css';\n\nconst DropDown = props => {\n const {options, onChange, theme: propsTheme} = props;\n\n const currentSelection = find('selected', options);\n const defaultTheme =\n !currentSelection || currentSelection.validOption === false ? 'invalid' : 'question';\n\n const theme = propsTheme || defaultTheme;\n\n return (\n <div className={style.wrapper}>\n <Select theme={theme} options={options} onChange={onChange} />\n </div>\n );\n};\n\nDropDown.propTypes = {\n onChange: Select.propTypes.onChange,\n options: PropTypes.arrayOf(PropTypes.shape(SelectOptionPropTypes)),\n theme: Select.propTypes.theme\n};\n\nexport default DropDown;\n"],"file":"index.js"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _getOr2 = _interopRequireDefault(require("lodash/fp/getOr"));
|
|
7
7
|
|
|
8
8
|
var _noop2 = _interopRequireDefault(require("lodash/fp/noop"));
|
|
9
9
|
|
|
@@ -11,6 +11,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
|
|
14
|
+
var _cssColorFunction = require("css-color-function");
|
|
15
|
+
|
|
14
16
|
var _provider = _interopRequireDefault(require("../../../atom/provider"));
|
|
15
17
|
|
|
16
18
|
var _style = _interopRequireDefault(require("./style.css"));
|
|
@@ -21,30 +23,45 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
const FreeText = (props, context) => {
|
|
27
29
|
const {
|
|
28
30
|
placeholder = '',
|
|
29
31
|
value = '',
|
|
30
|
-
onChange = _noop2.default
|
|
32
|
+
onChange = _noop2.default,
|
|
33
|
+
'aria-label': ariaLabel
|
|
31
34
|
} = props;
|
|
32
|
-
const
|
|
33
|
-
const
|
|
35
|
+
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
36
|
+
const handleChange = (0, _react.useCallback)(e => onChange(e.target.value), [onChange]);
|
|
37
|
+
const primarySkinColor = (0, _getOr2.default)('#00B0FF', 'skin.common.primary', context);
|
|
38
|
+
const handleMouseOver = (0, _react.useCallback)(() => setHovered(true), [setHovered]);
|
|
39
|
+
const handleMouseLeave = (0, _react.useCallback)(() => setHovered(false), [setHovered]);
|
|
40
|
+
const shadowBoxPrimaryColor = (0, _react.useMemo)(() => (0, _cssColorFunction.convert)(`color(${primarySkinColor} a(12%))`), [primarySkinColor]);
|
|
34
41
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
35
42
|
"data-name": "freeText",
|
|
36
|
-
className: _style.default.wrapper
|
|
43
|
+
className: _style.default.wrapper,
|
|
44
|
+
onMouseOver: handleMouseOver,
|
|
45
|
+
onMouseLeave: handleMouseLeave,
|
|
46
|
+
style: _extends({}, value && {
|
|
47
|
+
boxShadow: hovered ? 'none' : `0 4px 16px ${shadowBoxPrimaryColor}`
|
|
48
|
+
})
|
|
37
49
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
50
|
+
"data-name": "free-text-input",
|
|
38
51
|
type: "text",
|
|
39
|
-
|
|
52
|
+
"aria-label": ariaLabel || value || placeholder,
|
|
53
|
+
className: _style.default.freeText,
|
|
40
54
|
placeholder: placeholder,
|
|
41
55
|
value: value,
|
|
42
56
|
onInput: handleChange,
|
|
43
57
|
onChange: _noop2.default,
|
|
44
|
-
style: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
style: _extends(_extends({
|
|
59
|
+
boxShadow: `0 4px 16px ${shadowBoxPrimaryColor}`
|
|
60
|
+
}, value && {
|
|
61
|
+
boxShadow: `0 4px 16px ${hovered ? (0, _cssColorFunction.convert)(`color(${primarySkinColor} a(20%))`) : shadowBoxPrimaryColor}`
|
|
62
|
+
}), {}, {
|
|
63
|
+
color: primarySkinColor
|
|
64
|
+
})
|
|
48
65
|
}));
|
|
49
66
|
};
|
|
50
67
|
|
|
@@ -54,7 +71,8 @@ FreeText.contextTypes = {
|
|
|
54
71
|
FreeText.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
55
72
|
placeholder: _propTypes.default.string,
|
|
56
73
|
value: _propTypes.default.string,
|
|
57
|
-
onChange: _propTypes.default.func
|
|
74
|
+
onChange: _propTypes.default.func,
|
|
75
|
+
'aria-label': _propTypes.default.string
|
|
58
76
|
} : {};
|
|
59
77
|
var _default = FreeText;
|
|
60
78
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/molecule/questions/free-text/index.js"],"names":["FreeText","props","
|
|
1
|
+
{"version":3,"sources":["../../../../src/molecule/questions/free-text/index.js"],"names":["FreeText","props","context","placeholder","value","onChange","ariaLabel","hovered","setHovered","handleChange","e","target","primarySkinColor","handleMouseOver","handleMouseLeave","shadowBoxPrimaryColor","style","wrapper","boxShadow","freeText","color","contextTypes","skin","Provider","childContextTypes","propTypes","PropTypes","string","func"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,QAAQ,GAAG,CAACC,KAAD,EAAQC,OAAR,KAAoB;AACnC,QAAM;AAACC,IAAAA,WAAW,GAAG,EAAf;AAAmBC,IAAAA,KAAK,GAAG,EAA3B;AAA+BC,IAAAA,QAAQ,iBAAvC;AAAgD,kBAAcC;AAA9D,MAA2EL,KAAjF;AACA,QAAM,CAACM,OAAD,EAAUC,UAAV,IAAwB,qBAAS,KAAT,CAA9B;AAEA,QAAMC,YAAY,GAAG,wBAAYC,CAAC,IAAIL,QAAQ,CAACK,CAAC,CAACC,MAAF,CAASP,KAAV,CAAzB,EAA2C,CAACC,QAAD,CAA3C,CAArB;AACA,QAAMO,gBAAgB,GAAG,qBAAM,SAAN,EAAiB,qBAAjB,EAAwCV,OAAxC,CAAzB;AAEA,QAAMW,eAAe,GAAG,wBAAY,MAAML,UAAU,CAAC,IAAD,CAA5B,EAAoC,CAACA,UAAD,CAApC,CAAxB;AAEA,QAAMM,gBAAgB,GAAG,wBAAY,MAAMN,UAAU,CAAC,KAAD,CAA5B,EAAqC,CAACA,UAAD,CAArC,CAAzB;AAEA,QAAMO,qBAAqB,GAAG,oBAAQ,MAAM,+BAAS,SAAQH,gBAAiB,UAAlC,CAAd,EAA4D,CACxFA,gBADwF,CAA5D,CAA9B;AAIA,sBACE;AACE,iBAAU,UADZ;AAEE,IAAA,SAAS,EAAEI,eAAMC,OAFnB;AAGE,IAAA,WAAW,EAAEJ,eAHf;AAIE,IAAA,YAAY,EAAEC,gBAJhB;AAKE,IAAA,KAAK,eACCV,KAAK,IAAI;AACXc,MAAAA,SAAS,EAAEX,OAAO,GAAG,MAAH,GAAa,cAAaQ,qBAAsB;AADvD,KADV;AALP,kBAWE;AACE,iBAAU,iBADZ;AAEE,IAAA,IAAI,EAAC,MAFP;AAGE,kBAAYT,SAAS,IAAIF,KAAb,IAAsBD,WAHpC;AAIE,IAAA,SAAS,EAAEa,eAAMG,QAJnB;AAKE,IAAA,WAAW,EAAEhB,WALf;AAME,IAAA,KAAK,EAAEC,KANT;AAOE,IAAA,OAAO,EAAEK,YAPX;AAQE,IAAA,QAAQ,gBARV;AASE,IAAA,KAAK;AACHS,MAAAA,SAAS,EAAG,cAAaH,qBAAsB;AAD5C,OAECX,KAAK,IAAI;AACXc,MAAAA,SAAS,EAAG,cACVX,OAAO,GAAG,+BAAS,SAAQK,gBAAiB,UAAlC,CAAH,GAAkDG,qBAC1D;AAHU,KAFV;AAOHK,MAAAA,KAAK,EAAER;AAPJ;AATP,IAXF,CADF;AAiCD,CAhDD;;AAkDAZ,QAAQ,CAACqB,YAAT,GAAwB;AACtBC,EAAAA,IAAI,EAAEC,kBAASC,iBAAT,CAA2BF;AADX,CAAxB;AAIAtB,QAAQ,CAACyB,SAAT,2CAAqB;AACnBtB,EAAAA,WAAW,EAAEuB,mBAAUC,MADJ;AAEnBvB,EAAAA,KAAK,EAAEsB,mBAAUC,MAFE;AAGnBtB,EAAAA,QAAQ,EAAEqB,mBAAUE,IAHD;AAInB,gBAAcF,mBAAUC;AAJL,CAArB;eAOe3B,Q","sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport PropTypes from 'prop-types';\nimport {noop, getOr} from 'lodash/fp';\nimport {convert} from 'css-color-function';\nimport Provider from '../../../atom/provider';\nimport style from './style.css';\n\nconst FreeText = (props, context) => {\n const {placeholder = '', value = '', onChange = noop, 'aria-label': ariaLabel} = props;\n const [hovered, setHovered] = useState(false);\n\n const handleChange = useCallback(e => onChange(e.target.value), [onChange]);\n const primarySkinColor = getOr('#00B0FF', 'skin.common.primary', context);\n\n const handleMouseOver = useCallback(() => setHovered(true), [setHovered]);\n\n const handleMouseLeave = useCallback(() => setHovered(false), [setHovered]);\n\n const shadowBoxPrimaryColor = useMemo(() => convert(`color(${primarySkinColor} a(12%))`), [\n primarySkinColor\n ]);\n\n return (\n <div\n data-name=\"freeText\"\n className={style.wrapper}\n onMouseOver={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n style={{\n ...(value && {\n boxShadow: hovered ? 'none' : `0 4px 16px ${shadowBoxPrimaryColor}`\n })\n }}\n >\n <input\n data-name=\"free-text-input\"\n type=\"text\"\n aria-label={ariaLabel || value || placeholder}\n className={style.freeText}\n placeholder={placeholder}\n value={value}\n onInput={handleChange}\n onChange={noop}\n style={{\n boxShadow: `0 4px 16px ${shadowBoxPrimaryColor}`,\n ...(value && {\n boxShadow: `0 4px 16px ${\n hovered ? convert(`color(${primarySkinColor} a(20%))`) : shadowBoxPrimaryColor\n }`\n }),\n color: primarySkinColor\n }}\n />\n </div>\n );\n};\n\nFreeText.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\n\nFreeText.propTypes = {\n placeholder: PropTypes.string,\n value: PropTypes.string,\n onChange: PropTypes.func,\n 'aria-label': PropTypes.string\n};\n\nexport default FreeText;\n"],"file":"index.js"}
|
|
@@ -1,41 +1,65 @@
|
|
|
1
1
|
@value breakpoints: "../../../variables/breakpoints.css";
|
|
2
2
|
@value mobile from breakpoints;
|
|
3
3
|
@value colors: "../../../variables/colors.css";
|
|
4
|
-
@value
|
|
5
|
-
@value
|
|
4
|
+
@value box_shadow_light_dark from colors;
|
|
5
|
+
@value cm_blue_900 from colors;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
.freeText {
|
|
9
|
+
border: unset;
|
|
10
|
+
border-width: 0;
|
|
8
11
|
font-family: "Gilroy";
|
|
9
12
|
font-weight: 700;
|
|
10
13
|
text-transform: none;
|
|
11
|
-
padding: 0 15px;
|
|
12
|
-
border: solid 1px;
|
|
13
|
-
border-color: color(black lightness(85%));
|
|
14
14
|
height: 50px;
|
|
15
|
-
border-radius:
|
|
15
|
+
border-radius: 8px;
|
|
16
16
|
font-size: 14px;
|
|
17
|
-
width:
|
|
17
|
+
max-width: calc(100% - 24px);
|
|
18
|
+
width: 100%;
|
|
18
19
|
outline: none;
|
|
20
|
+
padding-left: 12px;
|
|
21
|
+
padding-right: 12px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.freeText::placeholder {
|
|
25
|
+
color: color(cm_blue_900 a(0.3));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.freeText:-ms-input-placeholder {
|
|
29
|
+
color: color(cm_blue_900 a(0.3))!important;
|
|
19
30
|
}
|
|
20
31
|
|
|
21
|
-
.
|
|
22
|
-
|
|
32
|
+
.freeText:focus {
|
|
33
|
+
outline: none;
|
|
23
34
|
}
|
|
24
35
|
|
|
25
|
-
.
|
|
36
|
+
.freeText:hover {
|
|
26
37
|
outline: none;
|
|
27
38
|
}
|
|
28
39
|
|
|
40
|
+
.wrapper {
|
|
41
|
+
border-radius: 8px;
|
|
42
|
+
box-shadow: 0px 4px 16px box_shadow_light_dark;
|
|
43
|
+
margin: 0 15px;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
width: 230px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.wrapper:hover {
|
|
49
|
+
box-shadow: none;
|
|
50
|
+
overflow: visible;
|
|
51
|
+
}
|
|
52
|
+
|
|
29
53
|
@media mobile {
|
|
30
54
|
.wrapper {
|
|
31
|
-
width:
|
|
55
|
+
max-width: calc(100% - 30px);
|
|
56
|
+
width: auto;
|
|
32
57
|
box-sizing: border-box;
|
|
33
|
-
max-width: 100%;
|
|
34
58
|
}
|
|
35
59
|
|
|
36
|
-
.
|
|
60
|
+
.freeText {
|
|
61
|
+
min-width: fit-content;
|
|
37
62
|
width: 100%;
|
|
38
|
-
margin: 0;
|
|
39
63
|
box-sizing: border-box;
|
|
40
64
|
}
|
|
41
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/default.js"],"names":["props","placeholder","
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/default.js"],"names":["props","placeholder","value","undefined"],"mappings":";;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,uBADR;AAELC,IAAAA,KAAK,EAAEC;AAFF;AADM,C","sourcesContent":["export default {\n props: {\n placeholder: 'Type your answer here',\n value: undefined\n }\n};\n"],"file":"default.js"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _default = {
|
|
6
|
+
props: {
|
|
7
|
+
placeholder: 'Type your answer here',
|
|
8
|
+
value: 'plop!',
|
|
9
|
+
onChange: () => {},
|
|
10
|
+
'aria-label': 'aria input'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.default = _default;
|
|
14
|
+
//# sourceMappingURL=with-value-on-change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/with-value-on-change.js"],"names":["props","placeholder","value","onChange"],"mappings":";;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,uBADR;AAELC,IAAAA,KAAK,EAAE,OAFF;AAGLC,IAAAA,QAAQ,EAAE,MAAM,CAAE,CAHb;AAIL,kBAAc;AAJT;AADM,C","sourcesContent":["export default {\n props: {\n placeholder: 'Type your answer here',\n value: 'plop!',\n onChange: () => {},\n 'aria-label': 'aria input'\n }\n};\n"],"file":"with-value-on-change.js"}
|
package/lib/molecule/questions/free-text/test/fixtures/{with-default-value.js → with-value.js}
RENAMED
|
@@ -5,8 +5,8 @@ exports.default = void 0;
|
|
|
5
5
|
var _default = {
|
|
6
6
|
props: {
|
|
7
7
|
placeholder: 'Type your answer here',
|
|
8
|
-
|
|
8
|
+
value: 'plop!'
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
exports.default = _default;
|
|
12
|
-
//# sourceMappingURL=with-
|
|
12
|
+
//# sourceMappingURL=with-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/with-value.js"],"names":["props","placeholder","value"],"mappings":";;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,uBADR;AAELC,IAAAA,KAAK,EAAE;AAFF;AADM,C","sourcesContent":["export default {\n props: {\n placeholder: 'Type your answer here',\n value: 'plop!'\n }\n};\n"],"file":"with-value.js"}
|
|
@@ -10,7 +10,9 @@ var _ = _interopRequireDefault(require(".."));
|
|
|
10
10
|
|
|
11
11
|
var _default = _interopRequireDefault(require("./fixtures/default"));
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _withValueOnChange = _interopRequireDefault(require("./fixtures/with-value-on-change"));
|
|
14
|
+
|
|
15
|
+
var _withValue = _interopRequireDefault(require("./fixtures/with-value"));
|
|
14
16
|
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
18
|
|
|
@@ -21,5 +23,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
21
23
|
});
|
|
22
24
|
});
|
|
23
25
|
(0, _ava.default)('MoleculeQuestions › MoleculeQuestionsFreeText › Default › should be rendered', _renderComponent.default, _.default, _default.default);
|
|
24
|
-
(0, _ava.default)('MoleculeQuestions › MoleculeQuestionsFreeText ›
|
|
26
|
+
(0, _ava.default)('MoleculeQuestions › MoleculeQuestionsFreeText › WithValueOnChange › should be rendered', _renderComponent.default, _.default, _withValueOnChange.default);
|
|
27
|
+
(0, _ava.default)('MoleculeQuestions › MoleculeQuestionsFreeText › WithValue › should be rendered', _renderComponent.default, _.default, _withValue.default);
|
|
25
28
|
//# sourceMappingURL=fixtures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/fixtures.js"],"names":["t","pass","MoleculeQuestionsFreeText","propTypes","value","key","not","undefined","renderComponentMacro","fixtureDefault","
|
|
1
|
+
{"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/fixtures.js"],"names":["t","pass","MoleculeQuestionsFreeText","propTypes","value","key","not","undefined","renderComponentMacro","fixtureDefault","fixtureWithValueOnChange","fixtureWithValue"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,kBAAK,6EAAL,EAAoFA,CAAC,IAAI;AACvFA,EAAAA,CAAC,CAACC,IAAF;AACA,wBAAQC,UAA0BC,SAAlC,EAA6C,CAACC,KAAD,EAAQC,GAAR,KAAgB;AAC3DL,IAAAA,CAAC,CAACM,GAAF,CAAMF,KAAN,EAAaG,SAAb,EAAyB,uEAAsEF,GAAI,mEAAnG;AACD,GAFD;AAGD,CALD;AAOA,kBAAK,8EAAL,EAAqFG,wBAArF,EAA2GN,SAA3G,EAAsIO,gBAAtI;AACA,kBAAK,wFAAL,EAA+FD,wBAA/F,EAAqHN,SAArH,EAAgJQ,0BAAhJ;AACA,kBAAK,gFAAL,EAAuFF,wBAAvF,EAA6GN,SAA7G,EAAwIS,kBAAxI","sourcesContent":["import test from 'ava';\nimport forEach from 'lodash/forEach';\nimport renderComponentMacro from '../../../../test/helpers/render-component';\nimport MoleculeQuestionsFreeText from '..';\nimport fixtureDefault from './fixtures/default';\nimport fixtureWithValueOnChange from './fixtures/with-value-on-change';\nimport fixtureWithValue from './fixtures/with-value';\n\ntest('MoleculeQuestions › MoleculeQuestionsFreeText > should have valid propTypes', t => {\n t.pass();\n forEach(MoleculeQuestionsFreeText.propTypes, (value, key) => {\n t.not(value, undefined, `PropType for \"MoleculeQuestions.MoleculeQuestionsFreeText.propTypes.${key}\" may not be undefined. Did you mistype the propTypes definition?`);\n });\n});\n\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › Default › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureDefault);\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › WithValueOnChange › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValueOnChange);\ntest('MoleculeQuestions › MoleculeQuestionsFreeText › WithValue › should be rendered', renderComponentMacro, MoleculeQuestionsFreeText, fixtureWithValue);\n"],"file":"fixtures.js"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _identity2 = _interopRequireDefault(require("lodash/fp/identity"));
|
|
4
|
+
|
|
5
|
+
var _browserEnv = _interopRequireDefault(require("browser-env"));
|
|
6
|
+
|
|
7
|
+
var _ava = _interopRequireDefault(require("ava"));
|
|
8
|
+
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
|
|
11
|
+
var _enzyme = require("enzyme");
|
|
12
|
+
|
|
13
|
+
var _enzymeAdapterReact = _interopRequireDefault(require("enzyme-adapter-react-16"));
|
|
14
|
+
|
|
15
|
+
var _ = _interopRequireDefault(require(".."));
|
|
16
|
+
|
|
17
|
+
var _default = _interopRequireDefault(require("./fixtures/default"));
|
|
18
|
+
|
|
19
|
+
var _withValue = _interopRequireDefault(require("./fixtures/with-value"));
|
|
20
|
+
|
|
21
|
+
var _withValueOnChange = _interopRequireDefault(require("./fixtures/with-value-on-change"));
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
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); }
|
|
26
|
+
|
|
27
|
+
(0, _browserEnv.default)();
|
|
28
|
+
(0, _enzyme.configure)({
|
|
29
|
+
adapter: new _enzymeAdapterReact.default()
|
|
30
|
+
});
|
|
31
|
+
const translate = _identity2.default;
|
|
32
|
+
(0, _ava.default)('onInput should be reachable and replace onChange, onChange should not trigger value changes, should use aria-label', t => {
|
|
33
|
+
t.plan(7);
|
|
34
|
+
let onInputWasTriggered = false;
|
|
35
|
+
|
|
36
|
+
const props = _extends(_extends({}, _withValueOnChange.default.props), {}, {
|
|
37
|
+
onChange: value => {
|
|
38
|
+
onInputWasTriggered = true;
|
|
39
|
+
t.is(value, 'new value');
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_.default, props), {
|
|
44
|
+
context: {
|
|
45
|
+
translate
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
let freeText = wrapper.find('[data-name="free-text-input"]');
|
|
49
|
+
t.true(freeText.at(0).exists());
|
|
50
|
+
t.is(freeText.at(0).props()['aria-label'], 'aria input');
|
|
51
|
+
t.is(freeText.at(0).props().value, 'plop!'); // should not trigger a value change with onChange
|
|
52
|
+
|
|
53
|
+
freeText.at(0).simulate('change', {
|
|
54
|
+
target: {
|
|
55
|
+
value: 'new value'
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
wrapper.update(); // should not update the trigger flag with onChange
|
|
59
|
+
|
|
60
|
+
t.false(onInputWasTriggered);
|
|
61
|
+
freeText.at(0).simulate('input', {
|
|
62
|
+
target: {
|
|
63
|
+
value: 'new value'
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
wrapper.update();
|
|
67
|
+
freeText = wrapper.find('[data-name="free-text-input"]');
|
|
68
|
+
t.true(onInputWasTriggered);
|
|
69
|
+
t.pass();
|
|
70
|
+
});
|
|
71
|
+
(0, _ava.default)('should set: boxShadow (hover & not hovered variants) && color for the input if a value is provided', t => {
|
|
72
|
+
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_.default, _withValue.default.props));
|
|
73
|
+
let freeTextWrapper = wrapper.find('[data-name="freeText"]');
|
|
74
|
+
t.true(freeTextWrapper.at(0).exists());
|
|
75
|
+
t.deepEqual(freeTextWrapper.at(0).props().style, {
|
|
76
|
+
boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'
|
|
77
|
+
});
|
|
78
|
+
let freeText = wrapper.find('[data-name="free-text-input"]');
|
|
79
|
+
t.true(freeText.at(0).exists());
|
|
80
|
+
t.is(freeText.at(0).props().value, 'plop!');
|
|
81
|
+
t.deepEqual(freeTextWrapper.at(0).props().style, {
|
|
82
|
+
boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'
|
|
83
|
+
});
|
|
84
|
+
freeTextWrapper.simulate('mouseover');
|
|
85
|
+
wrapper.update();
|
|
86
|
+
freeText = wrapper.find('[data-name="free-text-input"]');
|
|
87
|
+
freeTextWrapper = wrapper.find('[data-name="freeText"]'); // hovered
|
|
88
|
+
|
|
89
|
+
t.deepEqual(freeText.at(0).props().style, {
|
|
90
|
+
boxShadow: '0 4px 16px rgba(0, 176, 255, 0.2)',
|
|
91
|
+
color: '#00B0FF'
|
|
92
|
+
});
|
|
93
|
+
t.deepEqual(freeTextWrapper.at(0).props().style, {
|
|
94
|
+
boxShadow: 'none'
|
|
95
|
+
});
|
|
96
|
+
freeTextWrapper.simulate('mouseleave');
|
|
97
|
+
wrapper.update();
|
|
98
|
+
freeText = wrapper.find('[data-name="free-text-input"]');
|
|
99
|
+
t.deepEqual(freeText.at(0).props().style, {
|
|
100
|
+
boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)',
|
|
101
|
+
color: '#00B0FF'
|
|
102
|
+
});
|
|
103
|
+
t.pass();
|
|
104
|
+
});
|
|
105
|
+
(0, _ava.default)('should use value as default aria-label if no aria-label is provided', t => {
|
|
106
|
+
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_.default, _withValue.default.props));
|
|
107
|
+
const freeText = wrapper.find('[data-name="free-text-input"]');
|
|
108
|
+
t.true(freeText.at(0).exists());
|
|
109
|
+
t.is(freeText.at(0).props()['aria-label'], 'plop!');
|
|
110
|
+
t.pass();
|
|
111
|
+
});
|
|
112
|
+
(0, _ava.default)('should use placeholder as default aria-label if no aria-label is provided and no value is present', t => {
|
|
113
|
+
const wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react.default.createElement(_.default, _default.default.props));
|
|
114
|
+
const freeText = wrapper.find('[data-name="free-text-input"]');
|
|
115
|
+
t.true(freeText.at(0).exists());
|
|
116
|
+
t.is(freeText.at(0).props()['aria-label'], 'Type your answer here');
|
|
117
|
+
t.pass();
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=free-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/free-text.js"],"names":["adapter","Adapter","translate","t","plan","onInputWasTriggered","props","withValueOnChangeFixture","onChange","value","is","wrapper","context","freeText","find","true","at","exists","simulate","target","update","false","pass","withValueFixture","freeTextWrapper","deepEqual","style","boxShadow","color","defaultFixture"],"mappings":"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","sourcesContent":["import browserEnv from 'browser-env';\nimport test from 'ava';\nimport React from 'react';\nimport {shallow, mount, configure} from 'enzyme';\nimport {identity} from 'lodash/fp';\nimport Adapter from 'enzyme-adapter-react-16';\nimport FreeText from '..';\nimport defaultFixture from './fixtures/default';\nimport withValueFixture from './fixtures/with-value';\nimport withValueOnChangeFixture from './fixtures/with-value-on-change';\n\nbrowserEnv();\nconfigure({adapter: new Adapter()});\nconst translate = identity;\n\ntest('onInput should be reachable and replace onChange, onChange should not trigger value changes, should use aria-label', t => {\n t.plan(7);\n let onInputWasTriggered = false;\n const props = {\n ...withValueOnChangeFixture.props,\n onChange: value => {\n onInputWasTriggered = true;\n t.is(value, 'new value');\n }\n };\n const wrapper = shallow(<FreeText {...props} />, {\n context: {translate}\n });\n let freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(freeText.at(0).exists());\n t.is(freeText.at(0).props()['aria-label'], 'aria input');\n t.is(freeText.at(0).props().value, 'plop!');\n // should not trigger a value change with onChange\n freeText.at(0).simulate('change', {target: {value: 'new value'}});\n wrapper.update();\n // should not update the trigger flag with onChange\n t.false(onInputWasTriggered);\n freeText.at(0).simulate('input', {target: {value: 'new value'}});\n wrapper.update();\n freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(onInputWasTriggered);\n t.pass();\n});\n\ntest('should set: boxShadow (hover & not hovered variants) && color for the input if a value is provided', t => {\n const wrapper = mount(<FreeText {...withValueFixture.props} />);\n let freeTextWrapper = wrapper.find('[data-name=\"freeText\"]');\n t.true(freeTextWrapper.at(0).exists());\n t.deepEqual(freeTextWrapper.at(0).props().style, {\n boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'\n });\n\n let freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(freeText.at(0).exists());\n t.is(freeText.at(0).props().value, 'plop!');\n t.deepEqual(freeTextWrapper.at(0).props().style, {\n boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'\n });\n freeTextWrapper.simulate('mouseover');\n wrapper.update();\n\n freeText = wrapper.find('[data-name=\"free-text-input\"]');\n freeTextWrapper = wrapper.find('[data-name=\"freeText\"]');\n // hovered\n t.deepEqual(freeText.at(0).props().style, {\n boxShadow: '0 4px 16px rgba(0, 176, 255, 0.2)',\n color: '#00B0FF'\n });\n t.deepEqual(freeTextWrapper.at(0).props().style, {\n boxShadow: 'none'\n });\n\n freeTextWrapper.simulate('mouseleave');\n wrapper.update();\n freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.deepEqual(freeText.at(0).props().style, {\n boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)',\n color: '#00B0FF'\n });\n\n t.pass();\n});\n\ntest('should use value as default aria-label if no aria-label is provided', t => {\n const wrapper = mount(<FreeText {...withValueFixture.props} />);\n const freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(freeText.at(0).exists());\n t.is(freeText.at(0).props()['aria-label'], 'plop!');\n t.pass();\n});\n\ntest('should use placeholder as default aria-label if no aria-label is provided and no value is present', t => {\n const wrapper = mount(<FreeText {...defaultFixture.props} />);\n const freeText = wrapper.find('[data-name=\"free-text-input\"]');\n t.true(freeText.at(0).exists());\n t.is(freeText.at(0).props()['aria-label'], 'Type your answer here');\n t.pass();\n});\n"],"file":"free-text.js"}
|