@coorpacademy/components 10.5.7-alpha.11 → 10.5.7-alpha.6

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.
Files changed (83) hide show
  1. package/es/atom/select/index.js +20 -38
  2. package/es/atom/select/index.js.map +1 -1
  3. package/es/atom/select/style.css +40 -129
  4. package/es/atom/select/test/fixtures.js +0 -2
  5. package/es/atom/select/test/fixtures.js.map +1 -1
  6. package/es/molecule/cockpit-popin/test/fixtures.js +17 -0
  7. package/es/molecule/cockpit-popin/test/fixtures.js.map +1 -0
  8. package/es/molecule/questions/drop-down/index.js +6 -1
  9. package/es/molecule/questions/drop-down/index.js.map +1 -1
  10. package/es/molecule/questions/free-text/index.js +15 -35
  11. package/es/molecule/questions/free-text/index.js.map +1 -1
  12. package/es/molecule/questions/free-text/style.css +15 -35
  13. package/es/molecule/questions/free-text/test/fixtures/default.js +1 -1
  14. package/es/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
  15. package/es/molecule/questions/free-text/test/fixtures/{with-value.js → with-default-value.js} +2 -2
  16. package/es/molecule/questions/free-text/test/fixtures/with-default-value.js.map +1 -0
  17. package/es/molecule/questions/free-text/test/fixtures.js +2 -4
  18. package/es/molecule/questions/free-text/test/fixtures.js.map +1 -1
  19. package/es/molecule/questions/qcm/style.css +4 -0
  20. package/es/molecule/questions/qcm-graphic/index.js +1 -0
  21. package/es/molecule/questions/qcm-graphic/index.js.map +1 -1
  22. package/es/molecule/questions/qcm-graphic/style.css +12 -0
  23. package/es/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
  24. package/es/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
  25. package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
  26. package/es/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
  27. package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
  28. package/es/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
  29. package/es/molecule/questions/template/index.js +10 -13
  30. package/es/molecule/questions/template/index.js.map +1 -1
  31. package/es/molecule/search/test/fixtures.js +15 -0
  32. package/es/molecule/search/test/fixtures.js.map +1 -0
  33. package/lib/atom/select/index.js +17 -40
  34. package/lib/atom/select/index.js.map +1 -1
  35. package/lib/atom/select/style.css +40 -129
  36. package/lib/atom/select/test/fixtures.js +0 -3
  37. package/lib/atom/select/test/fixtures.js.map +1 -1
  38. package/lib/molecule/cockpit-popin/test/fixtures.js +28 -0
  39. package/lib/molecule/cockpit-popin/test/fixtures.js.map +1 -0
  40. package/lib/molecule/questions/drop-down/index.js +5 -1
  41. package/lib/molecule/questions/drop-down/index.js.map +1 -1
  42. package/lib/molecule/questions/free-text/index.js +14 -32
  43. package/lib/molecule/questions/free-text/index.js.map +1 -1
  44. package/lib/molecule/questions/free-text/style.css +15 -35
  45. package/lib/molecule/questions/free-text/test/fixtures/default.js +1 -1
  46. package/lib/molecule/questions/free-text/test/fixtures/default.js.map +1 -1
  47. package/lib/molecule/questions/free-text/test/fixtures/{with-value.js → with-default-value.js} +2 -2
  48. package/lib/molecule/questions/free-text/test/fixtures/with-default-value.js.map +1 -0
  49. package/lib/molecule/questions/free-text/test/fixtures.js +2 -5
  50. package/lib/molecule/questions/free-text/test/fixtures.js.map +1 -1
  51. package/lib/molecule/questions/qcm/style.css +4 -0
  52. package/lib/molecule/questions/qcm-graphic/index.js +1 -0
  53. package/lib/molecule/questions/qcm-graphic/index.js.map +1 -1
  54. package/lib/molecule/questions/qcm-graphic/style.css +12 -0
  55. package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js +1 -1
  56. package/lib/molecule/questions/qcm-graphic/test/fixtures/default.js.map +1 -1
  57. package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js +1 -1
  58. package/lib/molecule/questions/qcm-graphic/test/fixtures/no-selected.js.map +1 -1
  59. package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js +1 -1
  60. package/lib/molecule/questions/qcm-graphic/test/qcm-graphic.js.map +1 -1
  61. package/lib/molecule/questions/template/index.js +10 -13
  62. package/lib/molecule/questions/template/index.js.map +1 -1
  63. package/lib/molecule/search/test/fixtures.js +25 -0
  64. package/lib/molecule/search/test/fixtures.js.map +1 -0
  65. package/package.json +2 -2
  66. package/es/atom/select/test/fixtures/player.js +0 -11
  67. package/es/atom/select/test/fixtures/player.js.map +0 -1
  68. package/es/atom/select/test/select.js +0 -49
  69. package/es/atom/select/test/select.js.map +0 -1
  70. package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js +0 -9
  71. package/es/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +0 -1
  72. package/es/molecule/questions/free-text/test/fixtures/with-value.js.map +0 -1
  73. package/es/molecule/questions/free-text/test/free-text.js +0 -106
  74. package/es/molecule/questions/free-text/test/free-text.js.map +0 -1
  75. package/lib/atom/select/test/fixtures/player.js +0 -21
  76. package/lib/atom/select/test/fixtures/player.js.map +0 -1
  77. package/lib/atom/select/test/select.js +0 -62
  78. package/lib/atom/select/test/select.js.map +0 -1
  79. package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js +0 -14
  80. package/lib/molecule/questions/free-text/test/fixtures/with-value-on-change.js.map +0 -1
  81. package/lib/molecule/questions/free-text/test/fixtures/with-value.js.map +0 -1
  82. package/lib/molecule/questions/free-text/test/free-text.js +0 -119
  83. package/lib/molecule/questions/free-text/test/free-text.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/atom/select/test/select.js"],"names":["browserEnv","test","React","mount","configure","cloneDeep","noop","Adapter","Select","playerFixture","adapter","t","wrapper","props","selectWrapper","find","true","at","exists","deepEqual","style","color","selectSpan","is","className","withInvalid","options","name","value","selected","validOption"],"mappings":";;AAAA,OAAOA,UAAP,MAAuB,aAAvB;AACA,OAAOC,IAAP,MAAiB,KAAjB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,KAAR,EAAeC,SAAf,QAA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AAoB,CAApB,IAAyB;AACvBC,IAAAA,IAAI,EAAE,mEADiB;AAEvBC,IAAAA,KAAK,EAAE,mEAFgB;AAGvBC,IAAAA,QAAQ,EAAE,IAHa;AAIvBC,IAAAA,WAAW,EAAE;AAJU,GAAzB;AAMA,QAAMlB,OAAO,GAAGT,KAAK,eAAC,oBAAC,MAAD,eAAYsB,WAAZ;AAAyB,IAAA,QAAQ,EAAEnB;AAAnC,KAAD,CAArB;AACA,QAAMQ,aAAa,GAAGF,OAAO,CAACG,IAAR,CAAa,8BAAb,CAAtB;AACAJ,EAAAA,CAAC,CAACK,IAAF,CAAOF,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBC,MAApB,EAAP,EAVgG,CAWhG;;AACAP,EAAAA,CAAC,CAACQ,SAAF,CAAYL,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBJ,KAApB,GAA4BO,KAAxC,EAA+C,EAA/C;AACA,QAAME,UAAU,GAAGR,aAAa,CAACG,EAAd,CAAiB,CAAjB,EAAoBF,IAApB,CAAyB,2BAAzB,CAAnB;AACAJ,EAAAA,CAAC,CAACK,IAAF,CAAOM,UAAU,CAACL,EAAX,CAAc,CAAd,EAAiBC,MAAjB,EAAP;AACAP,EAAAA,CAAC,CAACY,EAAF,CACED,UAAU,CAACL,EAAX,CAAc,CAAd,EAAiBJ,KAAjB,GAAyBW,SAD3B,EAEE,4DAFF;AAID,CAnBG,CAAJ","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"}
@@ -1,9 +0,0 @@
1
- export default {
2
- props: {
3
- placeholder: 'Type your answer here',
4
- value: 'plop!',
5
- onChange: () => {},
6
- 'aria-label': 'aria input'
7
- }
8
- };
9
- //# sourceMappingURL=with-value-on-change.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/with-value-on-change.js"],"names":["props","placeholder","value","onChange"],"mappings":"AAAA,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,CAAf","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"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/molecule/questions/free-text/test/fixtures/with-value.js"],"names":["props","placeholder","value"],"mappings":"AAAA,eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,WAAW,EAAE,uBADR;AAELC,IAAAA,KAAK,EAAE;AAFF;AADM,CAAf","sourcesContent":["export default {\n props: {\n placeholder: 'Type your answer here',\n value: 'plop!'\n }\n};\n"],"file":"with-value.js"}
@@ -1,106 +0,0 @@
1
- import _identity from "lodash/fp/identity";
2
-
3
- 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); }
4
-
5
- import browserEnv from 'browser-env';
6
- import test from 'ava';
7
- import React from 'react';
8
- import { shallow, mount, configure } from 'enzyme';
9
- import Adapter from 'enzyme-adapter-react-16';
10
- import FreeText from '..';
11
- import defaultFixture from './fixtures/default';
12
- import withValueFixture from './fixtures/with-value';
13
- import withValueOnChangeFixture from './fixtures/with-value-on-change';
14
- browserEnv();
15
- configure({
16
- adapter: new Adapter()
17
- });
18
- const translate = _identity;
19
- test('onInput should be reachable and replace onChange, onChange should not trigger value changes, should use aria-label', t => {
20
- t.plan(7);
21
- let onInputWasTriggered = false;
22
-
23
- const props = _extends(_extends({}, withValueOnChangeFixture.props), {}, {
24
- onChange: value => {
25
- onInputWasTriggered = true;
26
- t.is(value, 'new value');
27
- }
28
- });
29
-
30
- const wrapper = shallow( /*#__PURE__*/React.createElement(FreeText, props), {
31
- context: {
32
- translate
33
- }
34
- });
35
- let freeText = wrapper.find('[data-name="free-text-input"]');
36
- t.true(freeText.at(0).exists());
37
- t.is(freeText.at(0).props()['aria-label'], 'aria input');
38
- t.is(freeText.at(0).props().value, 'plop!'); // should not trigger a value change with onChange
39
-
40
- freeText.at(0).simulate('change', {
41
- target: {
42
- value: 'new value'
43
- }
44
- });
45
- wrapper.update(); // should not update the trigger flag with onChange
46
-
47
- t.false(onInputWasTriggered);
48
- freeText.at(0).simulate('input', {
49
- target: {
50
- value: 'new value'
51
- }
52
- });
53
- wrapper.update();
54
- freeText = wrapper.find('[data-name="free-text-input"]');
55
- t.true(onInputWasTriggered);
56
- t.pass();
57
- });
58
- test('should set: boxShadow (hover & not hovered variants) && color for the input if a value is provided', t => {
59
- const wrapper = mount( /*#__PURE__*/React.createElement(FreeText, withValueFixture.props));
60
- let freeTextWrapper = wrapper.find('[data-name="freeText"]');
61
- t.true(freeTextWrapper.at(0).exists());
62
- t.deepEqual(freeTextWrapper.at(0).props().style, {
63
- boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'
64
- });
65
- let freeText = wrapper.find('[data-name="free-text-input"]');
66
- t.true(freeText.at(0).exists());
67
- t.is(freeText.at(0).props().value, 'plop!');
68
- t.deepEqual(freeTextWrapper.at(0).props().style, {
69
- boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)'
70
- });
71
- freeTextWrapper.simulate('mouseover');
72
- wrapper.update();
73
- freeText = wrapper.find('[data-name="free-text-input"]');
74
- freeTextWrapper = wrapper.find('[data-name="freeText"]'); // hovered
75
-
76
- t.deepEqual(freeText.at(0).props().style, {
77
- boxShadow: '0 4px 16px rgba(0, 176, 255, 0.2)',
78
- color: '#00B0FF'
79
- });
80
- t.deepEqual(freeTextWrapper.at(0).props().style, {
81
- boxShadow: 'none'
82
- });
83
- freeTextWrapper.simulate('mouseleave');
84
- wrapper.update();
85
- freeText = wrapper.find('[data-name="free-text-input"]');
86
- t.deepEqual(freeText.at(0).props().style, {
87
- boxShadow: '0 4px 16px rgba(0, 176, 255, 0.12)',
88
- color: '#00B0FF'
89
- });
90
- t.pass();
91
- });
92
- test('should use value as default aria-label if no aria-label is provided', t => {
93
- const wrapper = mount( /*#__PURE__*/React.createElement(FreeText, withValueFixture.props));
94
- const freeText = wrapper.find('[data-name="free-text-input"]');
95
- t.true(freeText.at(0).exists());
96
- t.is(freeText.at(0).props()['aria-label'], 'plop!');
97
- t.pass();
98
- });
99
- test('should use placeholder as default aria-label if no aria-label is provided and no value is present', t => {
100
- const wrapper = mount( /*#__PURE__*/React.createElement(FreeText, defaultFixture.props));
101
- const freeText = wrapper.find('[data-name="free-text-input"]');
102
- t.true(freeText.at(0).exists());
103
- t.is(freeText.at(0).props()['aria-label'], 'Type your answer here');
104
- t.pass();
105
- });
106
- //# sourceMappingURL=free-text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/molecule/questions/free-text/test/free-text.js"],"names":["browserEnv","test","React","shallow","mount","configure","Adapter","FreeText","defaultFixture","withValueFixture","withValueOnChangeFixture","adapter","translate","t","plan","onInputWasTriggered","props","onChange","value","is","wrapper","context","freeText","find","true","at","exists","simulate","target","update","false","pass","freeTextWrapper","deepEqual","style","boxShadow","color"],"mappings":";;;;AAAA,OAAOA,UAAP,MAAuB,aAAvB;AACA,OAAOC,IAAP,MAAiB,KAAjB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,OAAR,EAAiBC,KAAjB,EAAwBC,SAAxB,QAAwC,QAAxC;AAEA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,QAAP,MAAqB,IAArB;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AACA,OAAOC,gBAAP,MAA6B,uBAA7B;AACA,OAAOC,wBAAP,MAAqC,iCAArC;AAEAV,UAAU;AACVK,SAAS,CAAC;AAACM,EAAAA,OAAO,EAAE,IAAIL,OAAJ;AAAV,CAAD,CAAT;AACA,MAAMM,SAAS,YAAf;AAEAX,IAAI,CAAC,oHAAD,EAAuHY,CAAC,IAAI;AAC9HA,EAAAA,CAAC,CAACC,IAAF,CAAO,CAAP;AACA,MAAIC,mBAAmB,GAAG,KAA1B;;AACA,QAAMC,KAAK,yBACNN,wBAAwB,CAACM,KADnB;AAETC,IAAAA,QAAQ,EAAEC,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AA7B,CAAD,CAArB;AACA,QAAMM,QAAQ,GAAGF,OAAO,CAACG,IAAR,CAAa,+BAAb,CAAjB;AACAV,EAAAA,CAAC,CAACW,IAAF,CAAOF,QAAQ,CAACG,EAAT,CAAY,CAAZ,EAAeC,MAAf,EAAP;AACAb,EAAAA,CAAC,CAACM,EAAF,CAAKG,QAAQ,CAACG,EAAT,CAAY,CAAZ,EAAeT,KAAf,GAAuB,YAAvB,CAAL,EAA2C,uBAA3C;AACAH,EAAAA,CAAC,CAACkB,IAAF;AACD,CANG,CAAJ","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"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
-
6
- var _defaultsDeep2 = _interopRequireDefault(require("lodash/fp/defaultsDeep"));
7
-
8
- var _default2 = _interopRequireDefault(require("./default"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const {
13
- props
14
- } = _default2.default;
15
- var _default = {
16
- props: (0, _defaultsDeep2.default)(props, {
17
- theme: 'player'
18
- })
19
- };
20
- exports.default = _default;
21
- //# sourceMappingURL=player.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/atom/select/test/fixtures/player.js"],"names":["props","Default","theme"],"mappings":";;;;;;;AACA;;;;AAEA,MAAM;AAACA,EAAAA;AAAD,IAAUC,iBAAhB;eAEe;AACbD,EAAAA,KAAK,EAAE,4BAAaA,KAAb,EAAoB;AACzBE,IAAAA,KAAK,EAAE;AADkB,GAApB;AADM,C","sourcesContent":["import {defaultsDeep} from 'lodash/fp';\nimport Default from './default';\n\nconst {props} = Default;\n\nexport default {\n props: defaultsDeep(props, {\n theme: 'player'\n })\n};\n"],"file":"player.js"}
@@ -1,62 +0,0 @@
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
@@ -1 +0,0 @@
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","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;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"}
@@ -1,14 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1,119 +0,0 @@
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
@@ -1 +0,0 @@
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":";;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA;AACA,uBAAU;AAACA,EAAAA,OAAO,EAAE,IAAIC,2BAAJ;AAAV,CAAV;AACA,MAAMC,SAAS,qBAAf;AAEA,kBAAK,oHAAL,EAA2HC,CAAC,IAAI;AAC9HA,EAAAA,CAAC,CAACC,IAAF,CAAO,CAAP;AACA,MAAIC,mBAAmB,GAAG,KAA1B;;AACA,QAAMC,KAAK,yBACNC,2BAAyBD,KADnB;AAETE,IAAAA,QAAQ,EAAEC,KAAK,IAAI;AACjBJ,MAAAA,mBAAmB,GAAG,IAAtB;AACAF,MAAAA,CAAC,CAACO,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Y,CAAZ,EAAeC,MAAf,EAAP;AACAd,EAAAA,CAAC,CAACO,EAAF,CAAKG,QAAQ,CAACG,EAAT,CAAY,CAAZ,EAAeV,KAAf,GAAuB,YAAvB,CAAL,EAA2C,uBAA3C;AACAH,EAAAA,CAAC,CAACmB,IAAF;AACD,CAND","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"}