orc-shared 5.10.0-dev.2 → 5.10.0-dev.21
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/dist/actions/metadata.js +30 -11
- package/dist/actions/requestsApi.js +10 -1
- package/dist/components/AppFrame/About.js +136 -100
- package/dist/components/AppFrame/Anchor.js +45 -21
- package/dist/components/AppFrame/AppFrame.js +53 -31
- package/dist/components/AppFrame/Help.js +35 -15
- package/dist/components/AppFrame/MenuItem.js +148 -114
- package/dist/components/AppFrame/Preferences.js +136 -97
- package/dist/components/AppFrame/Sidebar.js +51 -28
- package/dist/components/AppFrame/Topbar.js +61 -36
- package/dist/components/ColumnWrapper.js +28 -5
- package/dist/components/Culture.js +33 -14
- package/dist/components/DropMenu/Menu.js +79 -45
- package/dist/components/DropMenu/index.js +34 -29
- package/dist/components/Form/Combination.js +45 -16
- package/dist/components/Form/Field.js +57 -38
- package/dist/components/Form/FieldElements.js +0 -11
- package/dist/components/Form/Fieldset.js +47 -19
- package/dist/components/Form/Form.js +22 -9
- package/dist/components/Form/FormElement.js +40 -7
- package/dist/components/Form/Inputs/Button.js +63 -18
- package/dist/components/Form/Inputs/ReadOnly.js +50 -27
- package/dist/components/{AppFrame/ApplicationSelector/Header.js → Form/Inputs/Selector.js} +30 -31
- package/dist/components/Form/Inputs/Text.js +20 -37
- package/dist/components/Form/Inputs/Toggles.js +39 -40
- package/dist/components/Form/Inputs/index.js +2 -13
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +31 -11
- package/dist/components/MaterialUI/DataDisplay/PredefinedElements/SectionToolbar.js +89 -0
- package/dist/components/MaterialUI/DataDisplay/Table.js +109 -18
- package/dist/components/MaterialUI/DataDisplay/TableProps.js +5 -1
- package/dist/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.js +198 -0
- package/dist/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +4 -1
- package/dist/components/MaterialUI/Inputs/DatePicker.js +14 -14
- package/dist/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -0
- package/dist/components/MaterialUI/Inputs/Select.js +2 -0
- package/dist/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/dist/components/MaterialUI/Inputs/Switch.js +17 -1
- package/dist/components/MaterialUI/Inputs/SwitchProps.js +2 -0
- package/dist/components/MaterialUI/Inputs/TimePicker.js +14 -21
- package/dist/components/MaterialUI/hocs/withDeferredTooltip.js +3 -1
- package/dist/components/MaterialUI/muiThemes.js +2 -1
- package/dist/components/Provision.js +1 -1
- package/dist/constants.js +2 -1
- package/dist/content/iconsSheet.svg +740 -116
- package/dist/hocs/withScrollBox.js +27 -12
- package/dist/hooks/useDaysAndMonthsLocalization.js +77 -0
- package/dist/hooks/useInMemoryPaging.js +135 -0
- package/dist/hooks/useMultipleFieldEditState.js +12 -3
- package/dist/reducers/metadata.js +6 -0
- package/dist/schemas/metadata.js +9 -1
- package/dist/selectors/locale.js +1 -0
- package/dist/selectors/metadata.js +14 -11
- package/dist/sharedMessages.js +184 -0
- package/dist/utils/ListHelper.js +271 -0
- package/dist/utils/comparisonHelper.js +185 -0
- package/dist/utils/propertyBagHelper.js +3 -1
- package/dist/utils/timezoneHelper.js +18 -31
- package/package.json +4 -3
- package/src/actions/metadata.js +11 -0
- package/src/actions/metadata.test.js +27 -0
- package/src/actions/requestsApi.js +6 -0
- package/src/components/AppFrame/About.js +97 -117
- package/src/components/AppFrame/About.test.js +128 -90
- package/src/components/AppFrame/Anchor.js +34 -36
- package/src/components/AppFrame/Anchor.test.js +5 -68
- package/src/components/AppFrame/AppFrame.js +31 -40
- package/src/components/AppFrame/AppFrame.test.js +424 -445
- package/src/components/AppFrame/Help.js +23 -20
- package/src/components/AppFrame/Help.test.js +3 -3
- package/src/components/AppFrame/MenuItem.js +106 -126
- package/src/components/AppFrame/MenuItem.test.js +78 -169
- package/src/components/AppFrame/Preferences.js +110 -98
- package/src/components/AppFrame/Preferences.test.js +115 -219
- package/src/components/AppFrame/Sidebar.js +39 -41
- package/src/components/AppFrame/Sidebar.test.js +88 -168
- package/src/components/AppFrame/Topbar.js +59 -52
- package/src/components/AppFrame/Topbar.test.js +31 -39
- package/src/components/ColumnWrapper.js +18 -9
- package/src/components/Culture.js +20 -10
- package/src/components/Culture.test.js +27 -16
- package/src/components/DropMenu/DropMenu.test.js +185 -224
- package/src/components/DropMenu/Menu.js +73 -80
- package/src/components/DropMenu/Menu.test.js +35 -86
- package/src/components/DropMenu/index.js +19 -15
- package/src/components/Form/Combination.js +35 -28
- package/src/components/Form/Combination.test.js +6 -19
- package/src/components/Form/Field.js +53 -66
- package/src/components/Form/Field.test.js +29 -51
- package/src/components/Form/FieldElements.js +0 -14
- package/src/components/Form/FieldElements.test.js +104 -111
- package/src/components/Form/Fieldset.js +42 -37
- package/src/components/Form/Fieldset.test.js +14 -7
- package/src/components/Form/Form.js +11 -7
- package/src/components/Form/Form.test.js +75 -56
- package/src/components/Form/FormElement.js +24 -16
- package/src/components/Form/InputField.test.js +24 -30
- package/src/components/Form/Inputs/Button.js +58 -14
- package/src/components/Form/Inputs/Button.test.js +32 -7
- package/src/components/Form/Inputs/Inputs.test.js +0 -7
- package/src/components/Form/Inputs/ReadOnly.js +34 -28
- package/src/components/Form/Inputs/ReadOnly.test.js +45 -7
- package/src/components/Form/Inputs/Selector.js +22 -0
- package/src/components/Form/Inputs/Selector.test.js +105 -0
- package/src/components/Form/Inputs/Text.js +15 -44
- package/src/components/Form/Inputs/Text.test.js +20 -29
- package/src/components/Form/Inputs/Toggles.js +27 -26
- package/src/components/Form/Inputs/Toggles.test.js +22 -28
- package/src/components/Form/Inputs/index.js +4 -15
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/InformationItem.test.js +1 -4
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.js +32 -6
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/Placeholder.test.js +3 -1
- package/src/components/MaterialUI/DataDisplay/PredefinedElements/SectionToolbar.js +39 -0
- package/src/components/MaterialUI/DataDisplay/Table.js +190 -114
- package/src/components/MaterialUI/DataDisplay/Table.test.js +246 -1
- package/src/components/MaterialUI/DataDisplay/TableProps.js +4 -0
- package/src/components/MaterialUI/DataDisplay/TableProps.test.js +2 -0
- package/src/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.js +145 -0
- package/src/components/MaterialUI/DataDisplay/TableWithInMemoryPaging.test.js +457 -0
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.js +5 -1
- package/src/components/MaterialUI/DataDisplay/TooltippedElements/MultipleLinesText.test.js +7 -1
- package/src/components/MaterialUI/Inputs/DatePicker.js +19 -20
- package/src/components/MaterialUI/Inputs/DatePicker.test.js +11 -6
- package/src/components/MaterialUI/Inputs/PredefinedElements/SearchControl.js +1 -0
- package/src/components/MaterialUI/Inputs/Select.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SelectProps.test.js +2 -0
- package/src/components/MaterialUI/Inputs/Switch.js +22 -1
- package/src/components/MaterialUI/Inputs/Switch.test.js +23 -0
- package/src/components/MaterialUI/Inputs/SwitchProps.js +2 -0
- package/src/components/MaterialUI/Inputs/SwitchProps.test.js +2 -0
- package/src/components/MaterialUI/Inputs/TimePicker.js +10 -19
- package/src/components/MaterialUI/Inputs/TimePicker.test.js +278 -117
- package/src/components/MaterialUI/hocs/withDeferredTooltip.js +4 -1
- package/src/components/MaterialUI/hocs/withDeferredTooltip.test.js +27 -0
- package/src/components/MaterialUI/muiThemes.js +1 -0
- package/src/components/Navigation/Bar.test.js +92 -87
- package/src/components/Provision.js +1 -1
- package/src/components/TaskDetailsModal.test.js +1 -3
- package/src/constants.js +1 -0
- package/src/content/iconsSheet.svg +740 -116
- package/src/hocs/withScrollBox.js +32 -19
- package/src/hocs/withScrollBox.test.js +15 -3
- package/src/hooks/useDaysAndMonthsLocalization.js +79 -0
- package/src/hooks/useDaysAndMonthsLocalization.test.js +107 -0
- package/src/hooks/useInMemoryPaging.js +78 -0
- package/src/hooks/useInMemoryPaging.test.js +515 -0
- package/src/hooks/useMultipleFieldEditState.js +11 -4
- package/src/hooks/useMultipleFieldEditState.test.js +49 -1
- package/src/reducers/metadata.js +6 -1
- package/src/reducers/metadata.test.js +31 -0
- package/src/requests +1 -0
- package/src/schemas/metadata.js +3 -0
- package/src/selectors/locale.js +1 -1
- package/src/selectors/metadata.js +12 -9
- package/src/selectors/metadata.test.js +92 -11
- package/src/sharedMessages.js +184 -0
- package/src/timezones.json +883 -0
- package/src/translations/en-US.json +46 -0
- package/src/translations/fr-CA.json +46 -0
- package/src/utils/ListHelper.js +203 -0
- package/src/utils/ListHelper.test.js +710 -0
- package/src/utils/comparisonHelper.js +135 -0
- package/src/utils/comparisonHelper.test.js +334 -0
- package/src/utils/propertyBagHelper.js +2 -0
- package/src/utils/propertyBagHelper.test.js +6 -0
- package/src/utils/timezoneHelper.js +10 -135
- package/src/utils/timezoneHelper.test.js +7 -7
- package/dist/components/Form/FieldList.js +0 -270
- package/dist/components/Form/Inputs/FieldButtons.js +0 -66
- package/dist/components/Form/Inputs/Number.js +0 -117
- package/dist/components/Form/Inputs/SmallButton.js +0 -91
- package/dist/components/Form/Inputs/Time.js +0 -86
- package/dist/components/Form/Inputs/Translation.js +0 -169
- package/src/components/AppFrame/ApplicationSelector/Header.js +0 -34
- package/src/components/AppFrame/ApplicationSelector/Header.test.js +0 -23
- package/src/components/Form/FieldList.js +0 -210
- package/src/components/Form/FieldList.test.js +0 -558
- package/src/components/Form/Inputs/FieldButtons.js +0 -90
- package/src/components/Form/Inputs/Number.js +0 -60
- package/src/components/Form/Inputs/Number.test.js +0 -435
- package/src/components/Form/Inputs/SmallButton.js +0 -37
- package/src/components/Form/Inputs/SmallButton.test.js +0 -65
- package/src/components/Form/Inputs/Time.js +0 -32
- package/src/components/Form/Inputs/Time.test.js +0 -41
- package/src/components/Form/Inputs/Translation.js +0 -93
- package/src/components/Form/Inputs/Translation.test.js +0 -204
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from "react";
|
|
2
|
-
import { useSelector } from "react-redux";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { getThemeProp, unwrapImmutable } from "../../../utils";
|
|
5
|
-
import Icon from "../../Icon";
|
|
6
|
-
import Text from "../../Text";
|
|
7
|
-
import { orderedCultureList } from "../../../selectors/locale";
|
|
8
|
-
import useToggle from "../../../hooks/useToggle";
|
|
9
|
-
import { FormInput } from "./Text";
|
|
10
|
-
import { ButtonWrapper } from "./FieldButtons";
|
|
11
|
-
|
|
12
|
-
export const LanguageLabel = styled.label`
|
|
13
|
-
flex: 0 0 auto;
|
|
14
|
-
min-width: 55px;
|
|
15
|
-
border-right: 1px solid ${getThemeProp(["colors", "borderLight"], "#cccccc")};
|
|
16
|
-
padding: 5px 10px;
|
|
17
|
-
background-color: #eaeaea;
|
|
18
|
-
margin-right: 0;
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
export const TranslationField = ({ lang, message = "", onChange, required, ...props }) => (
|
|
22
|
-
<ButtonWrapper invalid={required && !message}>
|
|
23
|
-
<LanguageLabel>{lang}</LanguageLabel>
|
|
24
|
-
<FormInput value={message} onChange={onChange} {...props} />
|
|
25
|
-
</ButtonWrapper>
|
|
26
|
-
);
|
|
27
|
-
TranslationField.displayName = "TranslationField";
|
|
28
|
-
|
|
29
|
-
export const TranslationWrapper = styled.div`
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-direction: column;
|
|
32
|
-
|
|
33
|
-
& > * {
|
|
34
|
-
margin-top: 10px;
|
|
35
|
-
}
|
|
36
|
-
& > :first-child {
|
|
37
|
-
margin-top: 0;
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
export const ShowButton = styled.div.attrs(() => ({
|
|
42
|
-
role: "button",
|
|
43
|
-
}))`
|
|
44
|
-
align-self: flex-end;
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
export const ShowButtonChevron = styled(Icon).attrs(props => ({
|
|
49
|
-
id: getThemeProp(["icons", "indicators", "down"], "chevron-down")(props),
|
|
50
|
-
}))`
|
|
51
|
-
font-size: 10px;
|
|
52
|
-
margin-right: 5px;
|
|
53
|
-
color: ${getThemeProp(["colors", "application", "base"], "#000")};
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
export const TranslationInput = ({ update, value = {}, initShowAll, required, moreLabel = "[more]", ...props }) => {
|
|
57
|
-
const cultures = unwrapImmutable(useSelector(orderedCultureList));
|
|
58
|
-
const handlers = useMemo(
|
|
59
|
-
() =>
|
|
60
|
-
cultures.reduce((handlers, lang) => {
|
|
61
|
-
handlers[lang] = event => {
|
|
62
|
-
update({ ...value, [lang]: event.target.value });
|
|
63
|
-
};
|
|
64
|
-
return handlers;
|
|
65
|
-
}, {}),
|
|
66
|
-
[update, cultures, value],
|
|
67
|
-
);
|
|
68
|
-
const [showAll, toggle] = useToggle(initShowAll);
|
|
69
|
-
return (
|
|
70
|
-
<TranslationWrapper>
|
|
71
|
-
{cultures.map((lang, index) =>
|
|
72
|
-
!index || showAll ? (
|
|
73
|
-
<TranslationField
|
|
74
|
-
key={lang}
|
|
75
|
-
lang={lang}
|
|
76
|
-
message={value[lang]}
|
|
77
|
-
onChange={handlers[lang]}
|
|
78
|
-
required={required}
|
|
79
|
-
{...props}
|
|
80
|
-
/>
|
|
81
|
-
) : null,
|
|
82
|
-
)}
|
|
83
|
-
{!showAll && cultures.length > 1 ? (
|
|
84
|
-
<ShowButton onClick={toggle}>
|
|
85
|
-
<ShowButtonChevron />
|
|
86
|
-
<Text message={moreLabel} />
|
|
87
|
-
</ShowButton>
|
|
88
|
-
) : null}
|
|
89
|
-
</TranslationWrapper>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default TranslationInput;
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import Immutable from "immutable";
|
|
3
|
-
import { Provider } from "react-redux";
|
|
4
|
-
import { IntlProvider } from "react-intl";
|
|
5
|
-
import { MemoryRouter } from "react-router-dom";
|
|
6
|
-
import { Ignore } from "unexpected-reaction";
|
|
7
|
-
import sinon from "sinon";
|
|
8
|
-
import { spyOnConsole, getStyledClassSelector } from "../../../utils/testUtils";
|
|
9
|
-
import { ButtonWrapper } from "./FieldButtons";
|
|
10
|
-
import { FormInput } from "./Text";
|
|
11
|
-
import TranslationInput, {
|
|
12
|
-
TranslationWrapper,
|
|
13
|
-
TranslationField,
|
|
14
|
-
ShowButton,
|
|
15
|
-
ShowButtonChevron,
|
|
16
|
-
LanguageLabel,
|
|
17
|
-
} from "./Translation";
|
|
18
|
-
|
|
19
|
-
describe("TranslationInput", () => {
|
|
20
|
-
let state, store, update, handlers;
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
state = Immutable.fromJS({
|
|
23
|
-
locale: {
|
|
24
|
-
cultures: {
|
|
25
|
-
"en-US": {},
|
|
26
|
-
"en-CA": {},
|
|
27
|
-
"fr-CA": {},
|
|
28
|
-
},
|
|
29
|
-
defaultCulture: "en-CA",
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
store = {
|
|
33
|
-
subscribe: () => {},
|
|
34
|
-
dispatch: () => {},
|
|
35
|
-
getState: () => state,
|
|
36
|
-
};
|
|
37
|
-
update = sinon.spy().named("update");
|
|
38
|
-
handlers = { "en-US": () => {}, "en-CA": () => {}, "fr-CA": () => {} };
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("renders a field for the default culture, and a button to show others", () =>
|
|
42
|
-
expect(
|
|
43
|
-
<Provider store={store}>
|
|
44
|
-
<MemoryRouter>
|
|
45
|
-
<IntlProvider locale="en">
|
|
46
|
-
<TranslationInput name="test" value={{}} moreLabel="Show more things" />
|
|
47
|
-
</IntlProvider>
|
|
48
|
-
</MemoryRouter>
|
|
49
|
-
</Provider>,
|
|
50
|
-
"when mounted",
|
|
51
|
-
"to satisfy",
|
|
52
|
-
<TranslationWrapper>
|
|
53
|
-
<IntlProvider locale="en">
|
|
54
|
-
<TranslationField lang="en-CA" onChange={() => {}} />
|
|
55
|
-
</IntlProvider>
|
|
56
|
-
<ShowButton onClick={expect.it("to be a function")}>
|
|
57
|
-
<ShowButtonChevron />
|
|
58
|
-
Show more things
|
|
59
|
-
</ShowButton>
|
|
60
|
-
</TranslationWrapper>,
|
|
61
|
-
));
|
|
62
|
-
|
|
63
|
-
it("renders fields for all languages when button is clicked", () =>
|
|
64
|
-
expect(
|
|
65
|
-
<Provider store={store}>
|
|
66
|
-
<MemoryRouter>
|
|
67
|
-
<IntlProvider locale="en">
|
|
68
|
-
<TranslationInput name="test" value={{ "fr-CA": "Des mots" }} handlers={handlers} />
|
|
69
|
-
</IntlProvider>
|
|
70
|
-
</MemoryRouter>
|
|
71
|
-
</Provider>,
|
|
72
|
-
"when mounted",
|
|
73
|
-
"with event",
|
|
74
|
-
{ type: "click", target: getStyledClassSelector(ShowButton) },
|
|
75
|
-
"to satisfy",
|
|
76
|
-
<TranslationWrapper>
|
|
77
|
-
<IntlProvider locale="en">
|
|
78
|
-
<TranslationField lang="en-CA" onChange={() => {}} />
|
|
79
|
-
</IntlProvider>
|
|
80
|
-
<IntlProvider locale="en">
|
|
81
|
-
<TranslationField lang="en-US" onChange={() => {}} />
|
|
82
|
-
</IntlProvider>
|
|
83
|
-
<IntlProvider locale="en">
|
|
84
|
-
<TranslationField lang="fr-CA" message="Des mots" onChange={() => {}} />
|
|
85
|
-
</IntlProvider>
|
|
86
|
-
</TranslationWrapper>,
|
|
87
|
-
));
|
|
88
|
-
|
|
89
|
-
it("lets you update a single language", () =>
|
|
90
|
-
expect(
|
|
91
|
-
<Provider store={store}>
|
|
92
|
-
<MemoryRouter>
|
|
93
|
-
<IntlProvider locale="en-CA">
|
|
94
|
-
<TranslationInput
|
|
95
|
-
name="test"
|
|
96
|
-
value={{ "fr-CA": "Des mots" }}
|
|
97
|
-
update={update}
|
|
98
|
-
moreLabel="Show more things"
|
|
99
|
-
/>
|
|
100
|
-
</IntlProvider>
|
|
101
|
-
</MemoryRouter>
|
|
102
|
-
</Provider>,
|
|
103
|
-
"when mounted",
|
|
104
|
-
"with event",
|
|
105
|
-
{ type: "change", value: "New", target: "input" },
|
|
106
|
-
).then(() =>
|
|
107
|
-
expect(update, "to have calls satisfying", [
|
|
108
|
-
{
|
|
109
|
-
args: [
|
|
110
|
-
{
|
|
111
|
-
"en-CA": "New",
|
|
112
|
-
"fr-CA": "Des mots",
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
]),
|
|
117
|
-
));
|
|
118
|
-
|
|
119
|
-
it("handles no cultures being loaded gracefully", () => {
|
|
120
|
-
state = state.setIn(["locale", "cultures"], Immutable.Map());
|
|
121
|
-
return expect(
|
|
122
|
-
<Provider store={store}>
|
|
123
|
-
<MemoryRouter>
|
|
124
|
-
<TranslationInput name="test" value={{ "fr-CA": "Des mots" }} update={update} moreLabel="Show more things" />
|
|
125
|
-
</MemoryRouter>
|
|
126
|
-
</Provider>,
|
|
127
|
-
"when mounted",
|
|
128
|
-
"to be a",
|
|
129
|
-
"DOMElement",
|
|
130
|
-
);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it("handles being required but missing", () =>
|
|
134
|
-
expect(
|
|
135
|
-
<Provider store={store}>
|
|
136
|
-
<MemoryRouter>
|
|
137
|
-
<IntlProvider locale="en">
|
|
138
|
-
<TranslationInput name="test" value={{}} required moreLabel="Show more things" />
|
|
139
|
-
</IntlProvider>
|
|
140
|
-
</MemoryRouter>
|
|
141
|
-
</Provider>,
|
|
142
|
-
"when mounted",
|
|
143
|
-
"to satisfy",
|
|
144
|
-
expect
|
|
145
|
-
.it(
|
|
146
|
-
"to satisfy",
|
|
147
|
-
<TranslationWrapper>
|
|
148
|
-
<IntlProvider locale="en">
|
|
149
|
-
<TranslationField lang="en-CA" required onChange={() => {}} />
|
|
150
|
-
</IntlProvider>
|
|
151
|
-
<ShowButton onClick={expect.it("to be a function")}>
|
|
152
|
-
<ShowButtonChevron />
|
|
153
|
-
Show more things
|
|
154
|
-
</ShowButton>
|
|
155
|
-
</TranslationWrapper>,
|
|
156
|
-
)
|
|
157
|
-
.and(
|
|
158
|
-
"to contain",
|
|
159
|
-
<ButtonWrapper invalid={true}>
|
|
160
|
-
<Ignore />
|
|
161
|
-
<Ignore />
|
|
162
|
-
</ButtonWrapper>,
|
|
163
|
-
),
|
|
164
|
-
));
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe("TranslationField", () => {
|
|
168
|
-
spyOnConsole();
|
|
169
|
-
|
|
170
|
-
let onChange;
|
|
171
|
-
beforeEach(() => {
|
|
172
|
-
onChange = () => {};
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it("shows a single language label and a text field", () =>
|
|
176
|
-
expect(
|
|
177
|
-
<IntlProvider locale="en">
|
|
178
|
-
<TranslationField lang="en-US" message="A hat, pardner" onChange={onChange} otherProp />
|
|
179
|
-
</IntlProvider>,
|
|
180
|
-
"when mounted",
|
|
181
|
-
"to satisfy",
|
|
182
|
-
<ButtonWrapper>
|
|
183
|
-
<LanguageLabel>en-US</LanguageLabel>
|
|
184
|
-
<IntlProvider locale="en">
|
|
185
|
-
<FormInput value="A hat, pardner" onChange={onChange} otherProp />
|
|
186
|
-
</IntlProvider>
|
|
187
|
-
</ButtonWrapper>,
|
|
188
|
-
).then(() => expect([console.log, console.warn, console.error], "to have calls satisfying", [])));
|
|
189
|
-
|
|
190
|
-
it("handles missing message", () =>
|
|
191
|
-
expect(
|
|
192
|
-
<IntlProvider locale="en">
|
|
193
|
-
<TranslationField lang="en-US" onChange={onChange} otherProp />
|
|
194
|
-
</IntlProvider>,
|
|
195
|
-
"when mounted",
|
|
196
|
-
"to satisfy",
|
|
197
|
-
<ButtonWrapper>
|
|
198
|
-
<LanguageLabel>en-US</LanguageLabel>
|
|
199
|
-
<IntlProvider locale="en">
|
|
200
|
-
<FormInput value="" onChange={onChange} otherProp />
|
|
201
|
-
</IntlProvider>
|
|
202
|
-
</ButtonWrapper>,
|
|
203
|
-
).then(() => expect([console.log, console.warn, console.error], "to have calls satisfying", [])));
|
|
204
|
-
});
|