diff --git a/components/__snapshots__/formatted_markdown_message.test.jsx.snap b/components/__snapshots__/formatted_markdown_message.test.jsx.snap index be6303654296..cf032272612e 100644 --- a/components/__snapshots__/formatted_markdown_message.test.jsx.snap +++ b/components/__snapshots__/formatted_markdown_message.test.jsx.snap @@ -2,6 +2,9 @@ exports[`components/FormattedMarkdownMessage should backup to default 1`] = ` - @@ -23,19 +28,24 @@ exports[`components/FormattedMarkdownMessage should backup to default 1`] = ` "defaultFormats": Object {}, "defaultLocale": "en", "formatDate": [Function], + "formatDateToParts": [Function], "formatHTMLMessage": [Function], + "formatList": [Function], "formatMessage": [Function], "formatNumber": [Function], + "formatNumberToParts": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], + "formatTimeToParts": [Function], "formats": Object {}, "formatters": Object { "getDateTimeFormat": [Function], + "getListFormat": [Function], "getMessageFormat": [Function], "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], + "getPluralRules": [Function], + "getRelativeTimeFormat": [Function], }, "locale": "en", "messages": Object { @@ -43,10 +53,9 @@ exports[`components/FormattedMarkdownMessage should backup to default 1`] = ` "test.foo": "**bold** *italic* [link](https://mattermost.com/)
[link target blank](!https://mattermost.com/)", "test.vals": "*Hi* {petName}!", }, - "now": [Function], "onError": [Function], - "textComponent": "span", - "timeZone": null, + "textComponent": Symbol(react.fragment), + "timeZone": undefined, } } > @@ -58,12 +67,15 @@ exports[`components/FormattedMarkdownMessage should backup to default 1`] = ` } /> -
+
`; exports[`components/FormattedMarkdownMessage should escape non-BR 1`] = ` - @@ -85,19 +99,24 @@ exports[`components/FormattedMarkdownMessage should escape non-BR 1`] = ` "defaultFormats": Object {}, "defaultLocale": "en", "formatDate": [Function], + "formatDateToParts": [Function], "formatHTMLMessage": [Function], + "formatList": [Function], "formatMessage": [Function], "formatNumber": [Function], + "formatNumberToParts": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], + "formatTimeToParts": [Function], "formats": Object {}, "formatters": Object { "getDateTimeFormat": [Function], + "getListFormat": [Function], "getMessageFormat": [Function], "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], + "getPluralRules": [Function], + "getRelativeTimeFormat": [Function], }, "locale": "en", "messages": Object { @@ -105,10 +124,9 @@ exports[`components/FormattedMarkdownMessage should escape non-BR 1`] = ` "test.foo": "**bold** *italic* [link](https://mattermost.com/)
[link target blank](!https://mattermost.com/)", "test.vals": "*Hi* {petName}!", }, - "now": [Function], "onError": [Function], - "textComponent": "span", - "timeZone": null, + "textComponent": Symbol(react.fragment), + "timeZone": undefined, } } > @@ -120,12 +138,15 @@ exports[`components/FormattedMarkdownMessage should escape non-BR 1`] = ` } /> -
+
`; exports[`components/FormattedMarkdownMessage should render message 1`] = ` - @@ -147,19 +170,24 @@ exports[`components/FormattedMarkdownMessage should render message 1`] = ` "defaultFormats": Object {}, "defaultLocale": "en", "formatDate": [Function], + "formatDateToParts": [Function], "formatHTMLMessage": [Function], + "formatList": [Function], "formatMessage": [Function], "formatNumber": [Function], + "formatNumberToParts": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], + "formatTimeToParts": [Function], "formats": Object {}, "formatters": Object { "getDateTimeFormat": [Function], + "getListFormat": [Function], "getMessageFormat": [Function], "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], + "getPluralRules": [Function], + "getRelativeTimeFormat": [Function], }, "locale": "en", "messages": Object { @@ -167,10 +195,9 @@ exports[`components/FormattedMarkdownMessage should render message 1`] = ` "test.foo": "**bold** *italic* [link](https://mattermost.com/)
[link target blank](!https://mattermost.com/)", "test.vals": "*Hi* {petName}!", }, - "now": [Function], "onError": [Function], - "textComponent": "span", - "timeZone": null, + "textComponent": Symbol(react.fragment), + "timeZone": undefined, } } > @@ -182,12 +209,15 @@ exports[`components/FormattedMarkdownMessage should render message 1`] = ` } /> -
+
`; exports[`components/FormattedMarkdownMessage values should work 1`] = ` - [link target blank](!https://mattermost.com/)", "test.vals": "*Hi* {petName}!", }, - "now": [Function], "onError": [Function], - "textComponent": "span", - "timeZone": null, + "textComponent": Symbol(react.fragment), + "timeZone": undefined, } } values={ @@ -254,6 +290,6 @@ exports[`components/FormattedMarkdownMessage values should work 1`] = ` } /> - + `; diff --git a/components/__snapshots__/profile_picture.test.tsx.snap b/components/__snapshots__/profile_picture.test.tsx.snap index 5709daf87df3..744bc9421ddd 100644 --- a/components/__snapshots__/profile_picture.test.tsx.snap +++ b/components/__snapshots__/profile_picture.test.tsx.snap @@ -44,7 +44,7 @@ exports[`components/ProfilePicture should match snapshot, profile and src, defau - + + diff --git a/components/__snapshots__/setting_picture.test.jsx.snap b/components/__snapshots__/setting_picture.test.jsx.snap index 1c4e61a7e141..341175645d1a 100644 --- a/components/__snapshots__/setting_picture.test.jsx.snap +++ b/components/__snapshots__/setting_picture.test.jsx.snap @@ -631,7 +631,7 @@ exports[`components/SettingItemMin should match snapshot, team icon on file 1`] className="setting-list-item padding-top x2" id="setting-picture__helptext" > - @@ -801,7 +801,7 @@ exports[`components/SettingItemMin should match snapshot, team icon on source 1` className="setting-list-item padding-top x2" id="setting-picture__helptext" > - diff --git a/components/__snapshots__/shortcuts_modal.test.jsx.snap b/components/__snapshots__/shortcuts_modal.test.jsx.snap index 1b5e96e51120..37e00c1f1e38 100644 --- a/components/__snapshots__/shortcuts_modal.test.jsx.snap +++ b/components/__snapshots__/shortcuts_modal.test.jsx.snap @@ -1,29 +1,33 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/ShortcutsModal should match snapshot modal for Mac 1`] = ` - - - - - - + transition={[Function]} + /> + + `; exports[`components/ShortcutsModal should match snapshot modal for non-Mac like Windows/Linux 1`] = ` - - - - - - + transition={[Function]} + /> + + `; diff --git a/components/about_build_modal/__snapshots__/about_build_modal.test.jsx.snap b/components/about_build_modal/__snapshots__/about_build_modal.test.jsx.snap index 7846a3ed0de1..e3d99f635abf 100644 --- a/components/about_build_modal/__snapshots__/about_build_modal.test.jsx.snap +++ b/components/about_build_modal/__snapshots__/about_build_modal.test.jsx.snap @@ -203,7 +203,7 @@ exports[`components/AboutBuildModal should match snapshot for enterprise edition className="about-modal__notice form-group padding-top x2" >

- @@ -443,7 +443,7 @@ exports[`components/AboutBuildModal should match snapshot for team edition 1`] = className="about-modal__notice form-group padding-top x2" >

- @@ -694,7 +694,7 @@ exports[`components/AboutBuildModal should show ci if a ci build 1`] = ` className="about-modal__notice form-group padding-top x2" >

- @@ -933,7 +933,7 @@ exports[`components/AboutBuildModal should show dev if this is a dev build 1`] = className="about-modal__notice form-group padding-top x2" >

- diff --git a/components/access_history_modal/__snapshots__/access_history_modal.test.tsx.snap b/components/access_history_modal/__snapshots__/access_history_modal.test.tsx.snap index 7d1e9519ccb1..4dd7d0ae543b 100644 --- a/components/access_history_modal/__snapshots__/access_history_modal.test.tsx.snap +++ b/components/access_history_modal/__snapshots__/access_history_modal.test.tsx.snap @@ -52,7 +52,7 @@ exports[`components/AccessHistoryModal should match snapshot when audits exist 1 bsClass="modal-body" componentClass="div" > - -

} helpText={ - @@ -79,7 +79,7 @@ exports[`components/AdminConsole/CustomEnableDisableGuestAccountsSetting initial /> } helpText={ - diff --git a/components/admin_console/__snapshots__/elasticsearch_settings.test.jsx.snap b/components/admin_console/__snapshots__/elasticsearch_settings.test.jsx.snap index 190597546c99..d45fbf3ac89d 100644 --- a/components/admin_console/__snapshots__/elasticsearch_settings.test.jsx.snap +++ b/components/admin_console/__snapshots__/elasticsearch_settings.test.jsx.snap @@ -271,7 +271,7 @@ exports[`components/ElasticSearchSettings should match snapshot, disabled 1`] =
- - } helpText={ - @@ -60,6 +60,7 @@ exports[`components/MessageExportSettings should match snapshot, disabled, actia } @@ -79,7 +80,7 @@ exports[`components/MessageExportSettings should match snapshot, disabled, actia - } helpText={ - @@ -243,6 +244,7 @@ exports[`components/MessageExportSettings should match snapshot, disabled, globa } @@ -262,7 +264,7 @@ exports[`components/MessageExportSettings should match snapshot, disabled, globa } @@ -406,7 +409,7 @@ exports[`components/MessageExportSettings should match snapshot, disabled, globa value="globalRelay@mattermost.com" /> - } helpText={ - @@ -531,6 +534,7 @@ exports[`components/MessageExportSettings should match snapshot, enabled, actian } @@ -550,7 +554,7 @@ exports[`components/MessageExportSettings should match snapshot, enabled, actian - } helpText={ - @@ -714,6 +718,7 @@ exports[`components/MessageExportSettings should match snapshot, enabled, global } @@ -733,7 +738,7 @@ exports[`components/MessageExportSettings should match snapshot, enabled, global } @@ -877,7 +883,7 @@ exports[`components/MessageExportSettings should match snapshot, enabled, global value="globalRelay@mattermost.com" /> - - } createJobHelpText={ - diff --git a/components/admin_console/__snapshots__/schema_text.test.jsx.snap b/components/admin_console/__snapshots__/schema_text.test.jsx.snap index 2e503583bb25..7da7eee4ec10 100644 --- a/components/admin_console/__snapshots__/schema_text.test.jsx.snap +++ b/components/admin_console/__snapshots__/schema_text.test.jsx.snap @@ -17,7 +17,7 @@ exports[`SchemaText should render plain text correctly 1`] = ` `; exports[`SchemaText should render translated markdown text correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -116,7 +116,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_schemes className="banner__content" > - @@ -182,7 +182,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_schemes className="banner__content" > - @@ -296,7 +296,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_schemes className="banner__content" > - @@ -410,7 +410,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_schemes className="banner__content" > - diff --git a/components/admin_console/permission_schemes_settings/permission_system_scheme_settings/__snapshots__/permission_system_scheme_settings.test.jsx.snap b/components/admin_console/permission_schemes_settings/permission_system_scheme_settings/__snapshots__/permission_system_scheme_settings.test.jsx.snap index 7e0aa94e2d15..764efaa1bdc5 100644 --- a/components/admin_console/permission_schemes_settings/permission_system_scheme_settings/__snapshots__/permission_system_scheme_settings.test.jsx.snap +++ b/components/admin_console/permission_schemes_settings/permission_system_scheme_settings/__snapshots__/permission_system_scheme_settings.test.jsx.snap @@ -32,7 +32,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_system_ className="banner__content" > - @@ -389,7 +389,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_system_ className="banner__content" > - @@ -632,7 +632,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_system_ className="banner__content" > - @@ -875,7 +875,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_system_ className="banner__content" > - @@ -1118,7 +1118,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_system_ className="banner__content" > - diff --git a/components/admin_console/permission_schemes_settings/permission_team_scheme_settings/__snapshots__/permission_team_scheme_settings.test.jsx.snap b/components/admin_console/permission_schemes_settings/permission_team_scheme_settings/__snapshots__/permission_team_scheme_settings.test.jsx.snap index b8dc905bb1cd..89d9e312b83b 100644 --- a/components/admin_console/permission_schemes_settings/permission_team_scheme_settings/__snapshots__/permission_team_scheme_settings.test.jsx.snap +++ b/components/admin_console/permission_schemes_settings/permission_team_scheme_settings/__snapshots__/permission_team_scheme_settings.test.jsx.snap @@ -32,7 +32,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_team_sc className="banner__content" > - @@ -312,7 +312,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_team_sc className="banner__content" > - @@ -572,7 +572,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_team_sc className="banner__content" > - @@ -862,7 +862,7 @@ exports[`components/admin_console/permission_schemes_settings/permission_team_sc className="banner__content" > - diff --git a/components/admin_console/plugin_management/__snapshots__/plugin_management.test.jsx.snap b/components/admin_console/plugin_management/__snapshots__/plugin_management.test.jsx.snap index 21f595474985..3a7cc9a238c0 100644 --- a/components/admin_console/plugin_management/__snapshots__/plugin_management.test.jsx.snap +++ b/components/admin_console/plugin_management/__snapshots__/plugin_management.test.jsx.snap @@ -37,7 +37,7 @@ exports[`components/PluginManagement should match snapshot 1`] = ` /> } helpText={ - @@ -71,7 +71,7 @@ exports[`components/PluginManagement should match snapshot 1`] = ` /> } helpText={ - @@ -148,7 +148,7 @@ exports[`components/PluginManagement should match snapshot 1`] = `

- @@ -165,7 +165,7 @@ exports[`components/PluginManagement should match snapshot 1`] = ` /> } helpText={ - @@ -199,7 +199,7 @@ exports[`components/PluginManagement should match snapshot 1`] = ` /> } helpText={ - @@ -233,7 +233,7 @@ exports[`components/PluginManagement should match snapshot 1`] = ` /> } helpText={ - @@ -261,7 +261,7 @@ exports[`components/PluginManagement should match snapshot 1`] = ` disabled={false} helpText={

- @@ -301,6 +301,7 @@ exports[`components/PluginManagement should match snapshot 1`] = `

@@ -392,7 +393,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Plugins /> } helpText={ - @@ -469,7 +470,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Plugins

- @@ -486,7 +487,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Plugins /> } helpText={ - @@ -520,7 +521,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Plugins /> } helpText={ - @@ -554,7 +555,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Plugins /> } helpText={ - @@ -582,7 +583,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Plugins disabled={false} helpText={

- @@ -622,6 +623,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Plugins

@@ -713,7 +715,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Remote /> } helpText={ - @@ -747,7 +749,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Remote /> } helpText={ - @@ -824,7 +826,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Remote

- @@ -841,7 +843,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Remote /> } helpText={ - @@ -875,7 +877,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Remote /> } helpText={ - @@ -909,7 +911,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Remote /> } helpText={ - @@ -937,7 +939,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Remote disabled={true} helpText={

- @@ -977,6 +979,7 @@ exports[`components/PluginManagement should match snapshot when \`Enable Remote

@@ -1068,7 +1071,7 @@ exports[`components/PluginManagement should match snapshot when \`Require Signat /> } helpText={ - @@ -1102,7 +1105,7 @@ exports[`components/PluginManagement should match snapshot when \`Require Signat /> } helpText={ - @@ -1179,7 +1182,7 @@ exports[`components/PluginManagement should match snapshot when \`Require Signat

- @@ -1196,7 +1199,7 @@ exports[`components/PluginManagement should match snapshot when \`Require Signat /> } helpText={ - @@ -1230,7 +1233,7 @@ exports[`components/PluginManagement should match snapshot when \`Require Signat /> } helpText={ - @@ -1264,7 +1267,7 @@ exports[`components/PluginManagement should match snapshot when \`Require Signat /> } helpText={ - @@ -1292,7 +1295,7 @@ exports[`components/PluginManagement should match snapshot when \`Require Signat disabled={false} helpText={

- @@ -1332,6 +1335,7 @@ exports[`components/PluginManagement should match snapshot when \`Require Signat

@@ -1423,7 +1427,7 @@ exports[`components/PluginManagement should match snapshot, No installed plugins /> } helpText={ - @@ -1457,7 +1461,7 @@ exports[`components/PluginManagement should match snapshot, No installed plugins /> } helpText={ - @@ -1534,7 +1538,7 @@ exports[`components/PluginManagement should match snapshot, No installed plugins

- @@ -1551,7 +1555,7 @@ exports[`components/PluginManagement should match snapshot, No installed plugins /> } helpText={ - @@ -1585,7 +1589,7 @@ exports[`components/PluginManagement should match snapshot, No installed plugins /> } helpText={ - @@ -1619,7 +1623,7 @@ exports[`components/PluginManagement should match snapshot, No installed plugins /> } helpText={ - @@ -1647,7 +1651,7 @@ exports[`components/PluginManagement should match snapshot, No installed plugins disabled={false} helpText={

- @@ -1687,6 +1691,7 @@ exports[`components/PluginManagement should match snapshot, No installed plugins

@@ -1783,7 +1788,7 @@ exports[`components/PluginManagement should match snapshot, allow insecure URL e /> } helpText={ - @@ -1817,7 +1822,7 @@ exports[`components/PluginManagement should match snapshot, allow insecure URL e /> } helpText={ - @@ -1894,7 +1899,7 @@ exports[`components/PluginManagement should match snapshot, allow insecure URL e

- @@ -1911,7 +1916,7 @@ exports[`components/PluginManagement should match snapshot, allow insecure URL e /> } helpText={ - @@ -1945,7 +1950,7 @@ exports[`components/PluginManagement should match snapshot, allow insecure URL e /> } helpText={ - @@ -1979,7 +1984,7 @@ exports[`components/PluginManagement should match snapshot, allow insecure URL e /> } helpText={ - @@ -2007,7 +2012,7 @@ exports[`components/PluginManagement should match snapshot, allow insecure URL e disabled={false} helpText={

- @@ -2047,6 +2052,7 @@ exports[`components/PluginManagement should match snapshot, allow insecure URL e

@@ -2138,7 +2144,7 @@ exports[`components/PluginManagement should match snapshot, disabled 1`] = ` /> } helpText={ - @@ -2172,7 +2178,7 @@ exports[`components/PluginManagement should match snapshot, disabled 1`] = ` /> } helpText={ - @@ -2249,7 +2255,7 @@ exports[`components/PluginManagement should match snapshot, disabled 1`] = `

- @@ -2266,7 +2272,7 @@ exports[`components/PluginManagement should match snapshot, disabled 1`] = ` /> } helpText={ - @@ -2300,7 +2306,7 @@ exports[`components/PluginManagement should match snapshot, disabled 1`] = ` /> } helpText={ - @@ -2334,7 +2340,7 @@ exports[`components/PluginManagement should match snapshot, disabled 1`] = ` /> } helpText={ - @@ -2362,7 +2368,7 @@ exports[`components/PluginManagement should match snapshot, disabled 1`] = ` disabled={true} helpText={

- @@ -2466,7 +2472,7 @@ exports[`components/PluginManagement should match snapshot, text entered into th /> } helpText={ - @@ -2500,7 +2506,7 @@ exports[`components/PluginManagement should match snapshot, text entered into th /> } helpText={ - @@ -2577,7 +2583,7 @@ exports[`components/PluginManagement should match snapshot, text entered into th

- @@ -2594,7 +2600,7 @@ exports[`components/PluginManagement should match snapshot, text entered into th /> } helpText={ - @@ -2628,7 +2634,7 @@ exports[`components/PluginManagement should match snapshot, text entered into th /> } helpText={ - @@ -2662,7 +2668,7 @@ exports[`components/PluginManagement should match snapshot, text entered into th /> } helpText={ - @@ -2690,7 +2696,7 @@ exports[`components/PluginManagement should match snapshot, text entered into th disabled={false} helpText={

- @@ -2730,6 +2736,7 @@ exports[`components/PluginManagement should match snapshot, text entered into th

@@ -2821,7 +2828,7 @@ exports[`components/PluginManagement should match snapshot, upload disabled 1`] /> } helpText={ - @@ -2855,7 +2862,7 @@ exports[`components/PluginManagement should match snapshot, upload disabled 1`] /> } helpText={ - @@ -2932,7 +2939,7 @@ exports[`components/PluginManagement should match snapshot, upload disabled 1`]

- @@ -2949,7 +2956,7 @@ exports[`components/PluginManagement should match snapshot, upload disabled 1`] /> } helpText={ - @@ -2983,7 +2990,7 @@ exports[`components/PluginManagement should match snapshot, upload disabled 1`] /> } helpText={ - @@ -3017,7 +3024,7 @@ exports[`components/PluginManagement should match snapshot, upload disabled 1`] /> } helpText={ - @@ -3045,7 +3052,7 @@ exports[`components/PluginManagement should match snapshot, upload disabled 1`] disabled={false} helpText={

- @@ -3085,6 +3092,7 @@ exports[`components/PluginManagement should match snapshot, upload disabled 1`]

@@ -3176,7 +3184,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3210,7 +3218,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3287,7 +3295,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

- @@ -3304,7 +3312,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3338,7 +3346,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3372,7 +3380,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3400,7 +3408,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi disabled={false} helpText={

- @@ -3440,6 +3448,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

@@ -3592,7 +3601,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3626,7 +3635,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3703,7 +3712,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

- @@ -3720,7 +3729,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3754,7 +3763,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3788,7 +3797,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -3816,7 +3825,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi disabled={false} helpText={

- @@ -3856,6 +3865,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

@@ -3977,7 +3987,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4011,7 +4021,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4088,7 +4098,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

- @@ -4105,7 +4115,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4139,7 +4149,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4173,7 +4183,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4201,7 +4211,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi disabled={false} helpText={

- @@ -4241,6 +4251,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

@@ -4362,7 +4373,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4396,7 +4407,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4473,7 +4484,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

- @@ -4490,7 +4501,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4524,7 +4535,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4558,7 +4569,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4586,7 +4597,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi disabled={false} helpText={

- @@ -4626,6 +4637,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

@@ -4747,7 +4759,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4781,7 +4793,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4858,7 +4870,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

- @@ -4875,7 +4887,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4909,7 +4921,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4943,7 +4955,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi /> } helpText={ - @@ -4971,7 +4983,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi disabled={false} helpText={

- @@ -5011,6 +5023,7 @@ exports[`components/PluginManagement should match snapshot, with installed plugi

diff --git a/components/admin_console/request_button/__snapshots__/request_button.test.jsx.snap b/components/admin_console/request_button/__snapshots__/request_button.test.jsx.snap index 76b32dc885d5..bbc279f9792f 100644 --- a/components/admin_console/request_button/__snapshots__/request_button.test.jsx.snap +++ b/components/admin_console/request_button/__snapshots__/request_button.test.jsx.snap @@ -64,33 +64,6 @@ exports[`components/admin_console/request_button/request_button.jsx should match } id={null} includeDetailedError={true} - intl={ - Object { - "defaultFormats": Object {}, - "defaultLocale": "en", - "formatDate": [Function], - "formatHTMLMessage": [Function], - "formatMessage": [Function], - "formatNumber": [Function], - "formatPlural": [Function], - "formatRelative": [Function], - "formatTime": [Function], - "formats": Object {}, - "formatters": Object { - "getDateTimeFormat": [Function], - "getMessageFormat": [Function], - "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], - }, - "locale": "en", - "messages": Object {}, - "now": [Function], - "onError": [Function], - "textComponent": "span", - "timeZone": "Etc/UTC", - } - } requestAction={ [MockFunction] { "calls": Array [ @@ -232,33 +205,6 @@ exports[`components/admin_console/request_button/request_button.jsx should match } id={null} includeDetailedError={false} - intl={ - Object { - "defaultFormats": Object {}, - "defaultLocale": "en", - "formatDate": [Function], - "formatHTMLMessage": [Function], - "formatMessage": [Function], - "formatNumber": [Function], - "formatPlural": [Function], - "formatRelative": [Function], - "formatTime": [Function], - "formats": Object {}, - "formatters": Object { - "getDateTimeFormat": [Function], - "getMessageFormat": [Function], - "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], - }, - "locale": "en", - "messages": Object {}, - "now": [Function], - "onError": [Function], - "textComponent": "span", - "timeZone": "Etc/UTC", - } - } requestAction={ [MockFunction] { "calls": Array [ @@ -408,33 +354,6 @@ exports[`components/admin_console/request_button/request_button.jsx should match } id={null} includeDetailedError={false} - intl={ - Object { - "defaultFormats": Object {}, - "defaultLocale": "en", - "formatDate": [Function], - "formatHTMLMessage": [Function], - "formatMessage": [Function], - "formatNumber": [Function], - "formatPlural": [Function], - "formatRelative": [Function], - "formatTime": [Function], - "formats": Object {}, - "formatters": Object { - "getDateTimeFormat": [Function], - "getMessageFormat": [Function], - "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], - }, - "locale": "en", - "messages": Object {}, - "now": [Function], - "onError": [Function], - "textComponent": "span", - "timeZone": "Etc/UTC", - } - } requestAction={ [MockFunction] { "calls": Array [ @@ -559,33 +478,6 @@ exports[`components/admin_console/request_button/request_button.jsx should match } id={null} includeDetailedError={false} - intl={ - Object { - "defaultFormats": Object {}, - "defaultLocale": "en", - "formatDate": [Function], - "formatHTMLMessage": [Function], - "formatMessage": [Function], - "formatNumber": [Function], - "formatPlural": [Function], - "formatRelative": [Function], - "formatTime": [Function], - "formats": Object {}, - "formatters": Object { - "getDateTimeFormat": [Function], - "getMessageFormat": [Function], - "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], - }, - "locale": "en", - "messages": Object {}, - "now": [Function], - "onError": [Function], - "textComponent": "span", - "timeZone": "Etc/UTC", - } - } requestAction={ [MockFunction] { "calls": Array [ diff --git a/components/admin_console/system_users/__snapshots__/system_users.test.jsx.snap b/components/admin_console/system_users/__snapshots__/system_users.test.jsx.snap index e75a8dea4860..8d638797c8d7 100644 --- a/components/admin_console/system_users/__snapshots__/system_users.test.jsx.snap +++ b/components/admin_console/system_users/__snapshots__/system_users.test.jsx.snap @@ -57,7 +57,7 @@ exports[`components/admin_console/system_users should match default snapshot 1`] } message={
- diff --git a/components/admin_console/system_users/list/__snapshots__/system_users_list.test.jsx.snap b/components/admin_console/system_users/list/__snapshots__/system_users_list.test.jsx.snap index 0b851534b8db..73fa3d6961d2 100644 --- a/components/admin_console/system_users/list/__snapshots__/system_users_list.test.jsx.snap +++ b/components/admin_console/system_users/list/__snapshots__/system_users_list.test.jsx.snap @@ -98,12 +98,12 @@ exports[`components/admin_console/system_users/list should match default snapsho extraInfo={ Object { "id1": Array [ - , ", ", - , ], "id2": Array [ - , ", ", - , ], "id3": Array [ - , ", ", - , ], "id4": Array [ - , ", ", - , ], "id5": Array [ - , ", ", - , ", ", - , ", ", - , ], "id2": Array [ - , ", ", - , ", ", - , ], "id3": Array [ - , ", ", - , ", ", - , ], "id4": Array [ - , ", ", - , ", ", - , ], "id5": Array [ - , ", ", - , ", ", - , diff --git a/components/admin_console/system_users/system_users_dropdown/__snapshots__/system_users_dropdown.test.js.snap b/components/admin_console/system_users/system_users_dropdown/__snapshots__/system_users_dropdown.test.js.snap index c5e4217fa4e7..5a847437107e 100644 --- a/components/admin_console/system_users/system_users_dropdown/__snapshots__/system_users_dropdown.test.js.snap +++ b/components/admin_console/system_users/system_users_dropdown/__snapshots__/system_users_dropdown.test.js.snap @@ -2,7 +2,7 @@ exports[`components/admin_console/system_users/system_users_dropdown/system_users_dropdown.jsx renderDeactivateMemberModal should not render the bot accounts warning in case the user do not have any bot accounts 1`] = `
- - - - - - -
test
- diff --git a/components/admin_console/team_channel_settings/team/details/__snapshots__/team_profile.test.jsx.snap b/components/admin_console/team_channel_settings/team/details/__snapshots__/team_profile.test.jsx.snap index 93ef2aec51df..a08a77bfe21c 100644 --- a/components/admin_console/team_channel_settings/team/details/__snapshots__/team_profile.test.jsx.snap +++ b/components/admin_console/team_channel_settings/team/details/__snapshots__/team_profile.test.jsx.snap @@ -33,7 +33,7 @@ exports[`admin_console/team_channel_settings/team/TeamProfile should match snaps
- @@ -43,7 +43,7 @@ exports[`admin_console/team_channel_settings/team/TeamProfile should match snaps
- diff --git a/components/announcement_bar/__snapshots__/announcement_bar.test.jsx.snap b/components/announcement_bar/__snapshots__/announcement_bar.test.jsx.snap index 143e5c77eee6..1e6e6d54da5a 100644 --- a/components/announcement_bar/__snapshots__/announcement_bar.test.jsx.snap +++ b/components/announcement_bar/__snapshots__/announcement_bar.test.jsx.snap @@ -14,7 +14,7 @@ exports[`components/AnnouncementBar should match snapshot, bar not showing 1`] = id="announcement-bar__tooltip" placement="right" > - @@ -28,7 +28,7 @@ exports[`components/AnnouncementBar should match snapshot, bar not showing 1`] = } > - @@ -50,7 +50,7 @@ exports[`components/AnnouncementBar should match snapshot, bar showing 1`] = ` id="announcement-bar__tooltip" placement="right" > - @@ -64,7 +64,7 @@ exports[`components/AnnouncementBar should match snapshot, bar showing 1`] = ` } > - @@ -86,7 +86,7 @@ exports[`components/AnnouncementBar should match snapshot, bar showing, no dismi id="announcement-bar__tooltip" placement="right" > - @@ -100,7 +100,7 @@ exports[`components/AnnouncementBar should match snapshot, bar showing, no dismi } > - @@ -122,7 +122,7 @@ exports[`components/AnnouncementBar should match snapshot, dismissal 1`] = ` id="announcement-bar__tooltip" placement="right" > - @@ -136,7 +136,7 @@ exports[`components/AnnouncementBar should match snapshot, dismissal 1`] = ` } > - @@ -158,7 +158,7 @@ exports[`components/AnnouncementBar should match snapshot, dismissal 2`] = ` id="announcement-bar__tooltip" placement="right" > - @@ -172,7 +172,7 @@ exports[`components/AnnouncementBar should match snapshot, dismissal 2`] = ` } > - @@ -194,7 +194,7 @@ exports[`components/AnnouncementBar should match snapshot, dismissal 3`] = ` id="announcement-bar__tooltip" placement="right" > - @@ -208,7 +208,7 @@ exports[`components/AnnouncementBar should match snapshot, dismissal 3`] = ` } > - @@ -230,7 +230,7 @@ exports[`components/AnnouncementBar should match snapshot, props change 1`] = ` id="announcement-bar__tooltip" placement="right" > - @@ -244,7 +244,7 @@ exports[`components/AnnouncementBar should match snapshot, props change 1`] = ` } > - @@ -266,7 +266,7 @@ exports[`components/AnnouncementBar should match snapshot, props change 2`] = ` id="announcement-bar__tooltip" placement="right" > - @@ -280,7 +280,7 @@ exports[`components/AnnouncementBar should match snapshot, props change 2`] = ` } > - @@ -302,7 +302,7 @@ exports[`components/AnnouncementBar should match snapshot, props change 3`] = ` id="announcement-bar__tooltip" placement="right" > - @@ -316,7 +316,7 @@ exports[`components/AnnouncementBar should match snapshot, props change 3`] = ` } > - @@ -338,7 +338,7 @@ exports[`components/AnnouncementBar should match snapshot, props change 4`] = ` id="announcement-bar__tooltip" placement="right" > - @@ -352,7 +352,7 @@ exports[`components/AnnouncementBar should match snapshot, props change 4`] = ` } > - diff --git a/components/at_mention/__snapshots__/at_mention.test.jsx.snap b/components/at_mention/__snapshots__/at_mention.test.jsx.snap index e11a3caf99b5..dd24175f7a14 100644 --- a/components/at_mention/__snapshots__/at_mention.test.jsx.snap +++ b/components/at_mention/__snapshots__/at_mention.test.jsx.snap @@ -21,7 +21,7 @@ exports[`components/AtMention should match snapshot when mentioning current user rootClose={true} show={false} > - - - - - - - - + + + + + + `; @@ -144,33 +160,6 @@ exports[`components/ChannelHeaderMobile/ChannelInfoButton should match snapshot, "id": "channel_id", } } - intl={ - Object { - "defaultFormats": Object {}, - "defaultLocale": "en", - "formatDate": [Function], - "formatHTMLMessage": [Function], - "formatMessage": [Function], - "formatNumber": [Function], - "formatPlural": [Function], - "formatRelative": [Function], - "formatTime": [Function], - "formats": Object {}, - "formatters": Object { - "getDateTimeFormat": [Function], - "getMessageFormat": [Function], - "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], - }, - "locale": "en", - "messages": Object {}, - "now": [Function], - "onError": [Function], - "textComponent": "span", - "timeZone": "Etc/UTC", - } - } isReadOnly={false} > - + + + + + + `; diff --git a/components/channel_header_mobile/channel_info_button/channel_info_button.test.js b/components/channel_header_mobile/channel_info_button/channel_info_button.test.js index 31096a06462e..03228ca750b8 100644 --- a/components/channel_header_mobile/channel_info_button/channel_info_button.test.js +++ b/components/channel_header_mobile/channel_info_button/channel_info_button.test.js @@ -2,7 +2,8 @@ // See LICENSE.txt for license information. import React from 'react'; -import {OverlayTrigger} from 'react-bootstrap'; + +import OverlayTrigger from 'components/overlay_trigger'; import {mountWithIntl} from 'tests/helpers/intl-test-helper'; diff --git a/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.jsx.snap b/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.jsx.snap index 69fb34038a3c..05fb20bfcde1 100644 --- a/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.jsx.snap +++ b/components/channel_selector_modal/__snapshots__/channel_selector_modal.test.jsx.snap @@ -40,7 +40,7 @@ exports[`components/ChannelSelectorModal should match snapshot 1`] = ` componentClass="h1" id="channelSelectorModalLabel" > - diff --git a/components/common/comment_icon.tsx b/components/common/comment_icon.tsx index 875dddc2cc93..eead954a9c53 100644 --- a/components/common/comment_icon.tsx +++ b/components/common/comment_icon.tsx @@ -55,7 +55,6 @@ export default class CommentIcon extends React.PureComponent { return ( - - - - -

-

- @@ -235,7 +235,7 @@ exports[`components/create_post should match snapshot for center textbox 1`] = ` - - - -

- @@ -44,7 +44,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, comma

-

- @@ -121,7 +121,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, incom

- - @@ -200,7 +200,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, oauth

-
- -

- @@ -316,7 +316,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, outgo

- - - - - - - } emptyTextSearch={ - diff --git a/components/integrations/installed_outgoing_webhooks/__snapshots__/installed_outgoing_webhooks.test.jsx.snap b/components/integrations/installed_outgoing_webhooks/__snapshots__/installed_outgoing_webhooks.test.jsx.snap index a3834d6db53b..1cb02812e57c 100644 --- a/components/integrations/installed_outgoing_webhooks/__snapshots__/installed_outgoing_webhooks.test.jsx.snap +++ b/components/integrations/installed_outgoing_webhooks/__snapshots__/installed_outgoing_webhooks.test.jsx.snap @@ -126,7 +126,7 @@ exports[`components/integrations/InstalledOutgoingWebhooks should match snapshot /> } emptyTextSearch={ - diff --git a/components/intl_provider/intl_provider.jsx b/components/intl_provider/intl_provider.jsx index 8c4e909f9163..7252297f17db 100644 --- a/components/intl_provider/intl_provider.jsx +++ b/components/intl_provider/intl_provider.jsx @@ -68,6 +68,7 @@ export default class IntlProvider extends React.PureComponent { key={this.props.locale} locale={this.props.locale} messages={this.props.translations} + textComponent='span' > {this.props.children} diff --git a/components/invitation_modal/__snapshots__/invitation_modal.test.jsx.snap b/components/invitation_modal/__snapshots__/invitation_modal.test.jsx.snap index 802f8fc97f17..b70e37d91979 100644 --- a/components/invitation_modal/__snapshots__/invitation_modal.test.jsx.snap +++ b/components/invitation_modal/__snapshots__/invitation_modal.test.jsx.snap @@ -2,7 +2,7 @@ exports[`components/invitation_modal/InvitationModal should match the snapshot 1`] = ` -

- + `; exports[`components/invitation_modal/InvitationModal should match the snapshot when I have no permission to add users 1`] = ` -
- + `; exports[`components/invitation_modal/InvitationModal should match the snapshot when I have no permission to invite guests 1`] = ` - } /> -
- + `; exports[`components/invitation_modal/InvitationModal should match the snapshot when not show 1`] = ` -
- + `; diff --git a/components/invitation_modal/__snapshots__/invitation_modal_confirm_step.test.jsx.snap b/components/invitation_modal/__snapshots__/invitation_modal_confirm_step.test.jsx.snap index b994844abd16..b4e3cc6bed44 100644 --- a/components/invitation_modal/__snapshots__/invitation_modal_confirm_step.test.jsx.snap +++ b/components/invitation_modal/__snapshots__/invitation_modal_confirm_step.test.jsx.snap @@ -12,7 +12,7 @@ exports[`components/invitation_modal/InvitationModalConfirmStep should match the

- - - - - - - - @@ -332,7 +332,7 @@ exports[`components/invitation_modal/InvitationModalConfirmStep should match the

- - - - - @@ -67,7 +67,7 @@ exports[`components/invitation_modal/InvitationModalInitialStep should match the

- diff --git a/components/invitation_modal/__snapshots__/invitation_modal_members_step.test.jsx.snap b/components/invitation_modal/__snapshots__/invitation_modal_members_step.test.jsx.snap index eca31d67d471..de9b3c3f36e9 100644 --- a/components/invitation_modal/__snapshots__/invitation_modal_members_step.test.jsx.snap +++ b/components/invitation_modal/__snapshots__/invitation_modal_members_step.test.jsx.snap @@ -12,7 +12,7 @@ exports[`components/invitation_modal/InvitationModalMembersStep should match the

-

- diff --git a/components/overlay_trigger.test.tsx b/components/overlay_trigger.test.tsx new file mode 100644 index 000000000000..08b7d683b656 --- /dev/null +++ b/components/overlay_trigger.test.tsx @@ -0,0 +1,71 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {mount} from 'enzyme'; +import React from 'react'; +import {OverlayTrigger as BaseOverlayTrigger} from 'react-bootstrap'; +import {FormattedMessage, IntlProvider} from 'react-intl'; + +import OverlayTrigger from './overlay_trigger'; + +describe('OverlayTrigger', () => { + const testId = 'test.value'; + + const intlProviderProps = { + defaultLocale: 'en', + locale: 'en', + messages: { + [testId]: 'Actual value', + }, + }; + const testOverlay = ( + + ); + + // Intercept console error messages since we intentionally cause some as part of these tests + let originalConsoleError: () => void; + + beforeEach(() => { + originalConsoleError = console.error; + console.error = jest.fn(); + }); + + afterEach(() => { + console.error = originalConsoleError; + }); + + test('base OverlayTrigger should fail to pass intl to overlay', () => { + const wrapper = mount( + + + + + + ); + + const overlay = mount(wrapper.find(BaseOverlayTrigger).prop('overlay')); + + expect(overlay.text()).toBe('Default value'); + + // console.error will have been called by FormattedMessage because its intl context is missing + expect(console.error).toHaveBeenCalled(); + }); + + test('custom OverlayTrigger should fail to pass intl to overlay', () => { + const wrapper = mount( + + + + + + ); + + const overlay = mount(wrapper.find(BaseOverlayTrigger).prop('overlay')); + + expect(overlay.text()).toBe('Actual value'); + expect(console.error).not.toHaveBeenCalled(); + }); +}); diff --git a/components/overlay_trigger.tsx b/components/overlay_trigger.tsx index cbd531580197..5e4af38fca2b 100644 --- a/components/overlay_trigger.tsx +++ b/components/overlay_trigger.tsx @@ -1,9 +1,38 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -// This dummy component will be replaced by a functional one when react-intl is upgrade. For now, it just exists -// to reduce the size of eventual diff of that upgrade. +import React from 'react'; +import {OverlayTrigger as BaseOverlayTrigger, OverlayTriggerProps} from 'react-bootstrap'; +import {IntlContext, IntlShape} from 'react-intl'; -import {OverlayTrigger as BaseOverlayTrigger} from 'react-bootstrap'; +type Props = OverlayTriggerProps; -export default BaseOverlayTrigger; +export default class OverlayTrigger extends React.PureComponent { + static defaultProps = { + defaultOverlayShown: false, + trigger: ['hover', 'focus'] + } + + render() { + const {overlay, ...props} = this.props; + + // The overlay is rendered outside of the regular React context, and our version react-bootstrap can't forward + // that context itself, so we have to manually forward the react-intl context to this component's child. + const OverlayWrapper = ({intl, ...otherProps}: {intl: IntlShape}) => ( + + {React.cloneElement(overlay, otherProps)} + + ); + + return ( + + {(intl): React.ReactNode => ( + } + /> + )} + + ); + } +} diff --git a/components/permalink_view/__snapshots__/permalink_view.test.jsx.snap b/components/permalink_view/__snapshots__/permalink_view.test.jsx.snap index 08e18dad8a73..f86f67be9c48 100644 --- a/components/permalink_view/__snapshots__/permalink_view.test.jsx.snap +++ b/components/permalink_view/__snapshots__/permalink_view.test.jsx.snap @@ -5,7 +5,7 @@ exports[`components/PermalinkView should match snapshot 1`] = ` className="app__content" id="app-content" > - - - diff --git a/components/plugin_marketplace/__snapshots__/marketplace_modal.test.js.snap b/components/plugin_marketplace/__snapshots__/marketplace_modal.test.js.snap index 73896ba07563..618bbbdf50ea 100644 --- a/components/plugin_marketplace/__snapshots__/marketplace_modal.test.js.snap +++ b/components/plugin_marketplace/__snapshots__/marketplace_modal.test.js.snap @@ -161,7 +161,7 @@ exports[`components/marketplace/ InstalledPlugins should render with one plugin exports[`components/marketplace/ MarketplaceModal should render with error banner 1`] = ` - -

- + `; exports[`components/marketplace/ MarketplaceModal should render with no plugins installed 1`] = ` -
- + `; exports[`components/marketplace/ MarketplaceModal should render with plugins installed 1`] = ` -
- + `; diff --git a/components/plugin_marketplace/marketplace_item/__snapshots__/marketplace_item.test.js.snap b/components/plugin_marketplace/marketplace_item/__snapshots__/marketplace_item.test.js.snap index 16951d5d91b9..2f4444413c6b 100644 --- a/components/plugin_marketplace/marketplace_item/__snapshots__/marketplace_item.test.js.snap +++ b/components/plugin_marketplace/marketplace_item/__snapshots__/marketplace_item.test.js.snap @@ -860,6 +860,7 @@ exports[`components/MarketplaceItem UpdateConfirmationModal should add extra war release notes to learn about the changes included in this update." id="marketplace_modal.list.update_confirmation.message.current_with_release_notes" + tagName="span" values={ Object { "installedVersion": "0.0.1", @@ -874,6 +875,7 @@ exports[`components/MarketplaceItem UpdateConfirmationModal should add extra war release notes before upgrading." id="marketplace_modal.list.update_confirmation.message.warning_major_version_with_release_notes" + tagName="span" values={ Object { "releaseNotesUrl": "http://example.com/release", @@ -1013,33 +1015,6 @@ exports[`components/MarketplaceItem UpdateConfirmationModal should render withou exports[`components/MarketplaceItem UpdateDetails should render with release notes url 1`] = `
- @@ -44,7 +17,7 @@ exports[`components/post_view/DateSeparator should render date with timezone ena
- Sat, Jan 13, 2018 - +
@@ -99,33 +76,6 @@ exports[`components/post_view/DateSeparator should render date with timezone ena exports[`components/post_view/DateSeparator should render date without timezone 1`] = `
- Fri, Jan 12, 2018 - +
@@ -192,33 +146,6 @@ exports[`components/post_view/DateSeparator should render date without timezone @@ -232,7 +159,7 @@ exports[`components/post_view/DateSeparator should render date without timezone
- Fri, Jan 12, 2018 - +
diff --git a/components/post_view/post_list/__snapshots__/post_list.test.jsx.snap b/components/post_view/post_list/__snapshots__/post_list.test.jsx.snap index 09fcdcab116e..8c9fb1c60a6c 100644 --- a/components/post_view/post_list/__snapshots__/post_list.test.jsx.snap +++ b/components/post_view/post_list/__snapshots__/post_list.test.jsx.snap @@ -12,7 +12,7 @@ exports[`components/post_view/post_list snapshot for loading when there are no p className="post-list__content" id="virtualizedPostListContent" > - - `; exports[`components/post_view/post_list_row should render combined post 1`] = ` - - Add to a Channel - +
{ diff --git a/components/rhs_thread/__snapshots__/rhs_thread.test.jsx.snap b/components/rhs_thread/__snapshots__/rhs_thread.test.jsx.snap index 2163e42c446f..7a92483bc437 100644 --- a/components/rhs_thread/__snapshots__/rhs_thread.test.jsx.snap +++ b/components/rhs_thread/__snapshots__/rhs_thread.test.jsx.snap @@ -45,7 +45,7 @@ exports[`components/RhsThread should match snapshot 1`] = ` - - - @@ -18,7 +18,7 @@ exports[`components/SearchHint should match snapshot, with title 1`] = ` exports[`components/SearchHint should match snapshot, without title 1`] = ` - diff --git a/components/sidebar/__snapshots__/sidebar.test.jsx.snap b/components/sidebar/__snapshots__/sidebar.test.jsx.snap index dde8595b0a39..1108892d639f 100644 --- a/components/sidebar/__snapshots__/sidebar.test.jsx.snap +++ b/components/sidebar/__snapshots__/sidebar.test.jsx.snap @@ -112,21 +112,21 @@ exports[`component/sidebar/sidebar_channel/SidebarChannel should match snapshot, sectionType="public" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- @@ -43,7 +43,7 @@ exports[`component/sidebar/SidebarTutorialTip should match snapshot, with townSq />

-

-

-

- @@ -107,7 +107,7 @@ exports[`component/sidebar/SidebarTutorialTip should match snapshot, with townSq />

- @@ -134,7 +134,7 @@ exports[`component/sidebar/SidebarTutorialTip should match snapshot, with townSq />

-

-

-

- @@ -198,7 +198,7 @@ exports[`component/sidebar/SidebarTutorialTip should match snapshot, without tow />

- @@ -225,7 +225,7 @@ exports[`component/sidebar/SidebarTutorialTip should match snapshot, without tow />

-

-

-

- @@ -289,7 +289,7 @@ exports[`component/sidebar/SidebarTutorialTip should match snapshot, without tow />

- @@ -316,7 +316,7 @@ exports[`component/sidebar/SidebarTutorialTip should match snapshot, without tow />

-

-

-

- diff --git a/components/sidebar/sidebar.jsx b/components/sidebar/sidebar.jsx index 353c6416189d..58aea54e2d25 100644 --- a/components/sidebar/sidebar.jsx +++ b/components/sidebar/sidebar.jsx @@ -399,8 +399,8 @@ class Sidebar extends React.PureComponent { } updateScrollbarOnChannelChange = (channelId) => { - if (this.refs[channelId] && this.refs[channelId].getWrappedInstance().getWrappedInstance().refs.channel) { - const curChannel = this.refs[channelId].getWrappedInstance().getWrappedInstance().refs.channel.getBoundingClientRect(); + if (this.refs[channelId] && this.refs[channelId].getWrappedInstance().refs.channel) { + const curChannel = this.refs[channelId].getWrappedInstance().refs.channel.getBoundingClientRect(); if ((curChannel.top - Constants.CHANNEL_SCROLL_ADJUSTMENT < 0) || (curChannel.top + curChannel.height > this.refs.scrollbar.view.getBoundingClientRect().height)) { this.refs.scrollbar.scrollTop(this.refs.scrollbar.view.scrollTop + (curChannel.top - Constants.CHANNEL_SCROLL_ADJUSTMENT)); } diff --git a/components/sidebar/sidebar_channel/sidebar_channel.jsx b/components/sidebar/sidebar_channel/sidebar_channel.jsx index 4f1e77572b09..b2623b7921a3 100644 --- a/components/sidebar/sidebar_channel/sidebar_channel.jsx +++ b/components/sidebar/sidebar_channel/sidebar_channel.jsx @@ -320,4 +320,6 @@ class SidebarChannel extends React.PureComponent { } } -export default injectIntl(SidebarChannel, {withRef: true}); +const wrappedComponent = injectIntl(SidebarChannel, {forwardRef: true}); +wrappedComponent.displayName = 'injectIntl(SidebarChannel)'; +export default wrappedComponent; diff --git a/components/team_selector_modal/__snapshots__/team_selector_modal.test.jsx.snap b/components/team_selector_modal/__snapshots__/team_selector_modal.test.jsx.snap index 3675f2ec4ce6..a0f6aaac4c96 100644 --- a/components/team_selector_modal/__snapshots__/team_selector_modal.test.jsx.snap +++ b/components/team_selector_modal/__snapshots__/team_selector_modal.test.jsx.snap @@ -40,7 +40,7 @@ exports[`components/TeamSelectorModal should match snapshot 1`] = ` componentClass="h1" id="teamSelectorModalLabel" > - diff --git a/components/toggle_modal_button_redux/__snapshots__/toggle_modal_button_redux.test.jsx.snap b/components/toggle_modal_button_redux/__snapshots__/toggle_modal_button_redux.test.jsx.snap index fcfff8679e6a..db007c9a9665 100644 --- a/components/toggle_modal_button_redux/__snapshots__/toggle_modal_button_redux.test.jsx.snap +++ b/components/toggle_modal_button_redux/__snapshots__/toggle_modal_button_redux.test.jsx.snap @@ -1,13 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`components/ToggleModalButtonRedux component should match snapshot 1`] = ` - - - - - + + Delete Channel + + + + `; diff --git a/components/user_profile/__snapshots__/user_profile.test.jsx.snap b/components/user_profile/__snapshots__/user_profile.test.jsx.snap index 918ff87cbd0f..0c4941d71f6d 100644 --- a/components/user_profile/__snapshots__/user_profile.test.jsx.snap +++ b/components/user_profile/__snapshots__/user_profile.test.jsx.snap @@ -5,7 +5,7 @@ exports[`components/UserProfile should match snapshot 1`] = ` { }; const requiredProps = { - intl: {}, user, updateSection: jest.fn(), updateTab: jest.fn(), diff --git a/components/user_settings/notifications/__snapshots__/manage_auto_responder.test.jsx.snap b/components/user_settings/notifications/__snapshots__/manage_auto_responder.test.jsx.snap index 4ad5c3ecfd34..2b80d92534b8 100644 --- a/components/user_settings/notifications/__snapshots__/manage_auto_responder.test.jsx.snap +++ b/components/user_settings/notifications/__snapshots__/manage_auto_responder.test.jsx.snap @@ -5,33 +5,6 @@ exports[`components/user_settings/notifications/ManageAutoResponder should match autoResponderActive={false} autoResponderMessage="Hello World!" error="" - intl={ - Object { - "defaultFormats": Object {}, - "defaultLocale": "en", - "formatDate": [Function], - "formatHTMLMessage": [Function], - "formatMessage": [Function], - "formatNumber": [Function], - "formatPlural": [Function], - "formatRelative": [Function], - "formatTime": [Function], - "formats": Object {}, - "formatters": Object { - "getDateTimeFormat": [Function], - "getMessageFormat": [Function], - "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], - }, - "locale": "en", - "messages": Object {}, - "now": [Function], - "onError": [Function], - "textComponent": "span", - "timeZone": "Etc/UTC", - } - } saving={false} setParentState={[MockFunction]} submit={[MockFunction]} @@ -66,6 +39,7 @@ exports[`components/user_settings/notifications/ManageAutoResponder should match

, @@ -142,6 +116,7 @@ exports[`components/user_settings/notifications/ManageAutoResponder should match
, @@ -463,6 +412,7 @@ exports[`components/user_settings/notifications/ManageAutoResponder should match {
- {
- {
- { ); expect(wrapper).toMatchInlineSnapshot(` - { ); expect(wrapper).toMatchInlineSnapshot(` - Extra text - + `; diff --git a/components/widgets/menu/menu_items/menu_item_toggle_modal_redux.test.tsx b/components/widgets/menu/menu_items/menu_item_toggle_modal_redux.test.tsx index f831ae5699ca..f334398d085d 100644 --- a/components/widgets/menu/menu_items/menu_item_toggle_modal_redux.test.tsx +++ b/components/widgets/menu/menu_items/menu_item_toggle_modal_redux.test.tsx @@ -18,7 +18,7 @@ describe('components/MenuItemToggleModalRedux', () => { ); expect(wrapper).toMatchInlineSnapshot(` - { > Whatever - + `); }); diff --git a/i18n/i18n.jsx b/i18n/i18n.jsx index 2c7e2bbe0c9a..419ee46c3d06 100644 --- a/i18n/i18n.jsx +++ b/i18n/i18n.jsx @@ -32,22 +32,6 @@ const zhTW = require('./zh-TW.json'); const zhCN = require('./zh-CN.json'); -import {addLocaleData} from 'react-intl'; -import deLocaleData from 'react-intl/locale-data/de'; -import enLocaleData from 'react-intl/locale-data/en'; -import esLocaleData from 'react-intl/locale-data/es'; -import frLocaleData from 'react-intl/locale-data/fr'; -import itLocaleData from 'react-intl/locale-data/it'; -import jaLocaleData from 'react-intl/locale-data/ja'; -import koLocaleData from 'react-intl/locale-data/ko'; -import nlLocaleData from 'react-intl/locale-data/nl'; -import plLocaleData from 'react-intl/locale-data/pl'; -import ptLocaleData from 'react-intl/locale-data/pt'; -import roLocaleData from 'react-intl/locale-data/ro'; -import ruLocaleData from 'react-intl/locale-data/ru'; -import trLocaleData from 'react-intl/locale-data/tr'; -import ukLocaleData from 'react-intl/locale-data/uk'; -import zhLocaleData from 'react-intl/locale-data/zh'; import {getConfig} from 'mattermost-redux/selectors/entities/general'; import store from 'stores/redux_store.jsx'; @@ -178,19 +162,13 @@ export function isLanguageAvailable(locale) { } export function doAddLocaleData() { - addLocaleData(enLocaleData); - addLocaleData(deLocaleData); - addLocaleData(esLocaleData); - addLocaleData(frLocaleData); - addLocaleData(itLocaleData); - addLocaleData(jaLocaleData); - addLocaleData(koLocaleData); - addLocaleData(nlLocaleData); - addLocaleData(plLocaleData); - addLocaleData(ptLocaleData); - addLocaleData(roLocaleData); - addLocaleData(ruLocaleData); - addLocaleData(trLocaleData); - addLocaleData(ukLocaleData); - addLocaleData(zhLocaleData); + if (!Intl.PluralRules) { + // eslint-disable-next-line global-require + require('@formatjs/intl-pluralrules/polyfill-locales'); + } + + if (!Intl.RelativeTimeFormat) { + // eslint-disable-next-line global-require + require('@formatjs/intl-relativetimeformat/polyfill-locales'); + } } diff --git a/package-lock.json b/package-lock.json index 2ac808a33113..7f53a27638e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1474,26 +1474,47 @@ "integrity": "sha512-6PYY5DVdAY1ifaQW6XYTnOMihmBVT27elqSjEoodchsGjzYlEsTQMcEhSud99kVawatyTZRTiVkJ/c6lwbQ7nA==", "dev": true }, - "@formatjs/intl-pluralrules": { + "@formatjs/intl-listformat": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@formatjs/intl-pluralrules/-/intl-pluralrules-1.3.1.tgz", - "integrity": "sha512-Z3NlE4q6zzG3tum9r0q0fs30IW2pUDvwUjtP3sPimFIPcycHRC60hW5AR1PTE9N0OPOB6ntBx6ZWvASBcAFLrw==", + "resolved": "https://registry.npmjs.org/@formatjs/intl-listformat/-/intl-listformat-1.3.1.tgz", + "integrity": "sha512-ASkGifaQ0icJr4/WWPYLTFnhsEnV1RKorTtS6SAvAud9jIuUc7vMcbKiecxOKoOLS9K62itnbZ89UluTLQ6tgQ==", + "requires": { + "@formatjs/intl-utils": "^1.6.0" + } + }, + "@formatjs/intl-pluralrules": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@formatjs/intl-pluralrules/-/intl-pluralrules-1.3.9.tgz", + "integrity": "sha512-s1mMFgX9rnPVmeraZNphLI6MsATI5ssT21ubRIFxMTAaPS6nFe6J2VILZN78iOjWtUN6k1tRgmVJyu4QrLY2sg==", "requires": { - "@formatjs/intl-utils": "^1.4.0" + "@formatjs/intl-utils": "^1.6.0" } }, "@formatjs/intl-relativetimeformat": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-4.4.0.tgz", - "integrity": "sha512-8lXOWWvoIPJR8Ak1uywE/gajBmHppfIg6a1o/fyd3t6NV7Qe+PVj7SJ5SgyRUcK3xQVA6AXpDJ7LCyjo5iOD8g==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-4.5.1.tgz", + "integrity": "sha512-s32xwuxvkozX6NxUVAnEGZU1/k3HA3kSsRXtpCvftnCWsshNAUsUWLS/6GpfHcjLfY1XEGptSKouTasyGLZdsg==", + "requires": { + "@formatjs/intl-utils": "^1.6.0" + } + }, + "@formatjs/intl-unified-numberformat": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@formatjs/intl-unified-numberformat/-/intl-unified-numberformat-2.2.0.tgz", + "integrity": "sha512-A9ov4uO04pSHG5Iqcrc457hvsq3lz/oWQ3B0I03zbL1rnBC8ttrZEobw3X3k/tWYPXeNJbRtsSbXqzJo55NeBw==", "requires": { - "@formatjs/intl-utils": "^1.4.0" + "@formatjs/intl-utils": "^1.6.0" } }, "@formatjs/intl-utils": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-1.4.4.tgz", - "integrity": "sha512-FYLEfy5rn1AYV03Vm8ey4snJRwcXzlGJWdi+oDEAMogyhPoFX4Y/jCeFSMfkcxbztYfNM8zzJqXlRBTLtAYldg==" + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-1.6.0.tgz", + "integrity": "sha512-5D0C4tQgNFJNaJ17BYum0GfAcKNK3oa1VWzgkv/AN7i52fg4r69ZLcpEGpf6tZiX9Qld8CDwTQOeFt6fuOqgVw==" + }, + "@formatjs/macro": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@formatjs/macro/-/macro-0.2.6.tgz", + "integrity": "sha512-DfdnLJf8+PwLHzJECZ1Xfa8+sI9akQnUuLN2UdkaExTQmlY0Vs36rMzEP0JoVDBMk+KdQbJNt72rPeZkBNcKWg==" }, "@hot-loader/react-dom": { "version": "16.10.2", @@ -3256,12 +3277,16 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", - "dev": true, "requires": { "@types/react": "*", "hoist-non-react-statics": "^3.3.0" } }, + "@types/invariant": { + "version": "2.2.30", + "resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.30.tgz", + "integrity": "sha512-98fB+yo7imSD2F7PF7GIpELNgtLNgo5wjivu0W5V4jx+KVVJxo6p/qN4zdzSTBWy4/sN3pPyXwnhRSD28QX+ag==" + }, "@types/is-function": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/is-function/-/is-function-1.0.0.tgz", @@ -3370,8 +3395,7 @@ "@types/prop-types": { "version": "15.7.3", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.3.tgz", - "integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==", - "dev": true + "integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==" }, "@types/q": { "version": "1.5.2", @@ -3393,7 +3417,6 @@ "version": "16.8.24", "resolved": "https://registry.npmjs.org/@types/react/-/react-16.8.24.tgz", "integrity": "sha512-VpFHUoD37YNY2+lr/+c7qL/tZsIU/bKuskUF3tmGUArbxIcQdb5j3zvo4cuuzu2A6UaVmVn7sJ4PgWYNFEBGzg==", - "dev": true, "requires": { "@types/prop-types": "*", "csstype": "^2.2.0" @@ -3426,12 +3449,6 @@ "@types/react": "*" } }, - "@types/react-intl": { - "version": "2.3.18", - "resolved": "https://registry.npmjs.org/@types/react-intl/-/react-intl-2.3.18.tgz", - "integrity": "sha512-DVNJs49zUxKRZng8VuILE886Yihdsf3yLr5vHk9zJrmF8SyRSK3sxNSvikAKxNkv9hX55XBTJShz6CkJnbNjgg==", - "dev": true - }, "@types/react-redux": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.4.tgz", @@ -5331,7 +5348,7 @@ }, "p-cancelable": { "version": "0.4.1", - "resolved": "http://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==", "dev": true, "optional": true @@ -7496,14 +7513,14 @@ "dependencies": { "file-type": { "version": "3.9.0", - "resolved": "http://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", "dev": true, "optional": true }, "get-stream": { "version": "2.3.1", - "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", "dev": true, "optional": true, @@ -10947,6 +10964,15 @@ "rimraf": "2" } }, + "full-icu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/full-icu/-/full-icu-1.3.0.tgz", + "integrity": "sha512-LGLpSsbkHUT0T+EKrIJltYoejYzUqg1eW+n6wm/FTte1pDiYjeKTxO0uJvrE3jgv6V9eBzMAjF6A8jH16C0+eQ==", + "dev": true, + "requires": { + "icu4c-data": "^0.63.2" + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -11907,6 +11933,12 @@ "postcss": "^7.0.14" } }, + "icu4c-data": { + "version": "0.63.2", + "resolved": "https://registry.npmjs.org/icu4c-data/-/icu4c-data-0.63.2.tgz", + "integrity": "sha512-vT6/47CcBzDemlhRzkL7dZLoNvuUWjjiuKZHMt5T4dbkKAqLBh7ZQ33GU13ecC/aIcMlIdBOqtF4uIYTgWML4Q==", + "dev": true + }, "identity-obj-proxy": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz", @@ -12507,34 +12539,35 @@ "integrity": "sha1-giRKIZDE5Bn4Nx9ao02qNCDiq94=" }, "intl-format-cache": { - "version": "2.2.9", - "resolved": "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-2.2.9.tgz", - "integrity": "sha512-Zv/u8wRpekckv0cLkwpVdABYST4hZNTDaX7reFetrYTJwxExR2VyTqQm+l0WmL0Qo8Mjb9Tf33qnfj0T7pjxdQ==" + "version": "4.2.13", + "resolved": "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-4.2.13.tgz", + "integrity": "sha512-yIIS4bKrWzBcWcCHArmEYB+VMSlVUWwOGwSlhWVVVWgVcouejAOm+Ivk9UKN0FKBuFzryfmWUMvbCJuMuMXgDw==" + }, + "intl-locales-supported": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/intl-locales-supported/-/intl-locales-supported-1.8.4.tgz", + "integrity": "sha512-wO0JhDqhshhkq8Pa9CLcstqd1aCXjfMgfMzjD6mDreS3mTSDbjGiMU+07O8BdJGxed7Q0Wf3TFVjGq0W3Y0n1w==" }, "intl-messageformat": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-2.2.0.tgz", - "integrity": "sha1-NFvNRt5jC3aDMwwuUhd/9eq0hPw=", + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-7.7.2.tgz", + "integrity": "sha512-dcZxYh1laXLrv3VVb/Ke4lGee/NJmBcmA5ATPtX51dEL+aePs5GuQXD/MepxTv9M8kKqEt6KauGUwz6+X/tqBQ==", "requires": { - "intl-messageformat-parser": "1.4.0" + "intl-format-cache": "^4.2.13", + "intl-messageformat-parser": "^3.5.1" } }, "intl-messageformat-parser": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-1.4.0.tgz", - "integrity": "sha1-tD1FqXRoytvkQzHXS7Ho3qRPwHU=" - }, - "intl-relativeformat": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/intl-relativeformat/-/intl-relativeformat-2.2.0.tgz", - "integrity": "sha512-4bV/7kSKaPEmu6ArxXf9xjv1ny74Zkwuey8Pm01NH4zggPP7JHwg2STk8Y3JdspCKRDriwIyLRfEXnj2ZLr4Bw==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/intl-messageformat-parser/-/intl-messageformat-parser-3.5.1.tgz", + "integrity": "sha512-aCUjbLCZYhWJzC5gJiXKYR+OCE8rIegRBsjm1irJSH0AmeC7dIOp3nzOCc84BcyFX5baoXJfijV6SWqYUrN27w==", "requires": { - "intl-messageformat": "^2.0.0" + "@formatjs/intl-unified-numberformat": "^2.2.0" } }, "into-stream": { "version": "3.1.0", - "resolved": "http://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=", "dev": true, "optional": true, @@ -15984,7 +16017,7 @@ }, "p-is-promise": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", "dev": true, "optional": true @@ -17556,15 +17589,33 @@ } }, "react-intl": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-2.9.0.tgz", - "integrity": "sha512-27jnDlb/d2A7mSJwrbOBnUgD+rPep+abmoJE511Tf8BnoONIAUehy/U1zZCHGO17mnOwMWxqN4qC0nW11cD6rA==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/react-intl/-/react-intl-3.9.1.tgz", + "integrity": "sha512-F9nc8FD1Fuc14f921LnW+tvFHzI4vU8yrd95Hm4d1iYopt8KEa/Y3+Tg1QDysrRNXXC9+APwwfF0u34bLWF6LA==", "requires": { - "hoist-non-react-statics": "^3.3.0", - "intl-format-cache": "^2.0.5", - "intl-messageformat": "^2.1.0", - "intl-relativeformat": "^2.1.0", - "invariant": "^2.1.1" + "@formatjs/intl-listformat": "^1.3.1", + "@formatjs/intl-relativetimeformat": "^4.5.1", + "@formatjs/intl-unified-numberformat": "^2.2.0", + "@formatjs/macro": "^0.2.6", + "@types/hoist-non-react-statics": "^3.3.1", + "@types/invariant": "^2.2.30", + "hoist-non-react-statics": "^3.3.1", + "intl-format-cache": "^4.2.13", + "intl-locales-supported": "^1.8.4", + "intl-messageformat": "^7.7.0", + "intl-messageformat-parser": "^3.5.0", + "invariant": "^2.1.1", + "shallow-equal": "^1.1.0" + }, + "dependencies": { + "hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-wbg3bpgA/ZqWrZuMOeJi8+SKMhr7X9TesL/rXMjTzh0p0JUBo3II8DHboYbuIXWRlttrUFxwcu/5kygrCw8fJw==", + "requires": { + "react-is": "^16.7.0" + } + } } }, "react-is": { @@ -19326,8 +19377,7 @@ "shallow-equal": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.0.tgz", - "integrity": "sha512-Z21pVxR4cXsfwpMKMhCEIO1PCi5sp7KEp+CmOpBQ+E8GpHwKOw2sEzk7sgblM3d/j4z4gakoWEoPcjK0VJQogA==", - "dev": true + "integrity": "sha512-Z21pVxR4cXsfwpMKMhCEIO1PCi5sp7KEp+CmOpBQ+E8GpHwKOw2sEzk7sgblM3d/j4z4gakoWEoPcjK0VJQogA==" }, "shallow-equals": { "version": "1.0.0", diff --git a/package.json b/package.json index 097f53ae831d..ffe741bb48f0 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "version": "0.0.1", "private": true, "dependencies": { + "@formatjs/intl-pluralrules": "1.3.9", + "@formatjs/intl-relativetimeformat": "4.5.1", "@types/highlight.js": "9.12.3", "@typescript-eslint/parser": "2.6.0", "bootstrap": "3.4.1", "bootstrap-colorpicker": "2.5.2", "chart.js": "2.8.0", - "@formatjs/intl-pluralrules": "1.3.1", - "@formatjs/intl-relativetimeformat": "4.4.0", "compass-mixins": "0.12.10", "core-js": "3.3.6", "css-vars-ponyfill": "2.1.2", @@ -35,8 +35,8 @@ "localforage": "1.7.3", "localforage-observable": "2.0.0", "mark.js": "8.11.1", - "mattermost-redux": "github:mattermost/mattermost-redux#1fc5efc181ce2939d356e06c21f5e8b69e201d33", "marked": "github:mattermost/marked#8214e10918264fb88cec474196023949f7cb4b30", + "mattermost-redux": "github:mattermost/mattermost-redux#1fc5efc181ce2939d356e06c21f5e8b69e201d33", "moment-timezone": "0.5.27", "pdfjs-dist": "2.0.489", "popmotion": "8.7.0", @@ -52,7 +52,7 @@ "react-dom": "16.8.6", "react-hot-loader": "4.12.15", "react-inlinesvg": "1.0.0", - "react-intl": "2.9.0", + "react-intl": "3.9.1", "react-overlays": "1.2.0", "react-redux": "5.1.1", "react-router-dom": "5.0.1", @@ -106,7 +106,6 @@ "@types/react-bootstrap": "0.32.20", "@types/react-color": "3.0.1", "@types/react-dom": "16.8.5", - "@types/react-intl": "2.3.18", "@types/react-redux": "7.1.4", "@types/react-router-dom": "5.1.2", "@types/react-select": "^3.0.5", @@ -133,6 +132,7 @@ "eslint-plugin-react": "7.16.0", "exports-loader": "0.7.0", "file-loader": "4.2.0", + "full-icu": "1.3.0", "html-loader": "0.5.5", "html-webpack-plugin": "3.2.0", "identity-obj-proxy": "3.0.0", @@ -225,12 +225,12 @@ "build": "cross-env NODE_ENV=production webpack --display-error-details --verbose", "run": "webpack --progress --watch", "dev-server": "webpack-dev-server", - "test": "jest --forceExit --detectOpenHandles", - "test-ci": "jest --forceExit --detectOpenHandles --maxWorkers=2", + "test": "cross-env NODE_ICU_DATA=node_modules/full-icu jest --forceExit --detectOpenHandles", + "test-ci": "cross-env NODE_ICU_DATA=node_modules/full-icu jest --forceExit --detectOpenHandles --maxWorkers=2", "stats": "cross-env NODE_ENV=production webpack --profile --json > webpack_stats.json", "updatesnapshot": "jest --updateSnapshot", - "test:watch": "jest --watch", - "test:coverage": "jest --coverage", + "test:watch": "cross-env NODE_ICU_DATA=node_modules/full-icu jest --watch", + "test:coverage": "cross-env NODE_ICU_DATA=node_modules/full-icu jest --coverage", "mmjstool": "mmjstool", "storybook": "start-storybook -p 6006 -s ./storybook/static", "build-storybook": "build-storybook -s ./storybook/static", diff --git a/plugins/channel_header_plug/__snapshots__/channel_header_plug.test.jsx.snap b/plugins/channel_header_plug/__snapshots__/channel_header_plug.test.jsx.snap index 745842378225..f19c31b3ba15 100644 --- a/plugins/channel_header_plug/__snapshots__/channel_header_plug.test.jsx.snap +++ b/plugins/channel_header_plug/__snapshots__/channel_header_plug.test.jsx.snap @@ -66,17 +66,33 @@ exports[`plugins/ChannelHeaderPlug should match snapshot with one extended compo ] } > - + +
@@ -111,33 +127,6 @@ exports[`plugins/ChannelHeaderPlug should match snapshot with two extended compo }, ] } - intl={ - Object { - "defaultFormats": Object {}, - "defaultLocale": "en", - "formatDate": [Function], - "formatHTMLMessage": [Function], - "formatMessage": [Function], - "formatNumber": [Function], - "formatPlural": [Function], - "formatRelative": [Function], - "formatTime": [Function], - "formats": Object {}, - "formatters": Object { - "getDateTimeFormat": [Function], - "getMessageFormat": [Function], - "getNumberFormat": [Function], - "getPluralFormat": [Function], - "getRelativeFormat": [Function], - }, - "locale": "en", - "messages": Object {}, - "now": [Function], - "onError": [Function], - "textComponent": "span", - "timeZone": "Etc/UTC", - } - } theme={Object {}} >
(element: ReactElement): WrappedComponentElement { + const {type, props} = element as ReactElement; + if (type.$$typeof && type.$$typeof === Symbol.for('react.forward_ref')) { + type ForwardRefComponent = ForwardRefExoticComponent & { + render: () => ReactElement; + }; + return React.cloneElement( + (type as ForwardRefComponent).render(), + props, + ) as WrappedComponentElement; + } + return element as WrappedComponentElement; +} + +type IntlInjectedElement = ReactElement>; +export function isIntlInjectedElement(element: ReactElement): element is IntlInjectedElement { + const {type} = element; + if (typeof type === 'function' && type.name === 'WithIntl') { + return true; + } + return false; +} + +interface ShallowWithIntlOptions extends ShallowRendererProps { + intl?: IntlShape; +} + +export function shallowWithIntl(element: T, options?: ShallowWithIntlOptions) { + const {intl = defaultIntl, ...shallowOptions} = options || {}; + + // eslint-disable-next-line no-param-reassign + element = unwrapForwardRef(element); + + if (!isIntlInjectedElement(element)) { + throw new Error('shallowWithIntl() allows only components wrapped by injectIntl() HOC. Use shallow() instead.'); + } + + return shallow( + + // Unwrap injectIntl + , + + // Override options + shallowOptions, + ); +} + +interface MountWithIntlOptions extends MountRendererProps { + intl?: IntlShape; +} +export function mountWithIntl(element: T, options?: MountWithIntlOptions) { + const {intl = defaultIntl, ...mountOptions} = options || {}; + + // Unwrap injectIntl + const newElement = isIntlInjectedElement(element) ? ( + + ) : element; + + return mount( + newElement, + + // For useIntl, + { + wrappingComponent: IntlProvider, + wrappingComponentProps: {...intl}, + + // For legacy + context: { + intl, + ...mountOptions.context, + }, + childContextTypes: { + intl: PropTypes.any.isRequired, + ...mountOptions.childContextTypes, + }, + + // Override options + ...mountOptions, + }, + ); +} diff --git a/utils/admin_console_index.test.jsx b/utils/admin_console_index.test.jsx index fc695c114d0e..bc80fd1d466d 100644 --- a/utils/admin_console_index.test.jsx +++ b/utils/admin_console_index.test.jsx @@ -1,7 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import {IntlProvider} from 'react-intl'; +import {createIntl} from 'react-intl'; import AdminDefinition from 'components/admin_console/admin_definition.jsx'; @@ -14,8 +14,7 @@ const esMessages = require('../i18n/es'); describe('AdminConsoleIndex.generateIndex', () => { it('should generate a index where I can search', () => { - const intlProvider = new IntlProvider({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); - const {intl} = intlProvider.getChildContext(); + const intl = createIntl({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); const idx = generateIndex(AdminDefinition, {}, intl); expect(idx.search('ldap')).toEqual([ @@ -45,8 +44,7 @@ describe('AdminConsoleIndex.generateIndex', () => { }); it('should generate a index where I can search in other language', () => { - const intlProvider = new IntlProvider({locale: 'es', messages: esMessages, defaultLocale: 'es'}, {}); - const {intl} = intlProvider.getChildContext(); + const intl = createIntl({locale: 'es', messages: esMessages, defaultLocale: 'es'}, {}); const idx = generateIndex(AdminDefinition, {}, intl); expect(idx.search('ldap')).toEqual([ @@ -76,8 +74,7 @@ describe('AdminConsoleIndex.generateIndex', () => { }); it('should generate a index including the plugin settings', () => { - const intlProvider = new IntlProvider({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); - const {intl} = intlProvider.getChildContext(); + const intl = createIntl({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); const idx = generateIndex(AdminDefinition, {[samplePlugin1.id]: samplePlugin1, [samplePlugin2.id]: samplePlugin2}, intl); diff --git a/utils/post_utils.test.jsx b/utils/post_utils.test.jsx index 303e134a3a67..ed858c1ebb69 100644 --- a/utils/post_utils.test.jsx +++ b/utils/post_utils.test.jsx @@ -3,7 +3,7 @@ import assert from 'assert'; -import {IntlProvider} from 'react-intl'; +import {createIntl} from 'react-intl'; import * as PostUtils from 'utils/post_utils.jsx'; import {PostListRowListIds} from 'utils/constants'; @@ -629,8 +629,7 @@ describe('PostUtils.getLatestPostId', () => { describe('PostUtils.createAriaLabelForPost', () => { test('Should show username, timestamp, message, attachments, reactions, flagged and pinned', () => { - const intlProvider = new IntlProvider({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); - const {intl} = intlProvider.getChildContext(); + const intl = createIntl({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); const testPost = { message: 'test_message', @@ -659,8 +658,7 @@ describe('PostUtils.createAriaLabelForPost', () => { assert.ok(ariaLabel.indexOf('message is flagged and pinned')); }); test('Should show that message is a reply', () => { - const intlProvider = new IntlProvider({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); - const {intl} = intlProvider.getChildContext(); + const intl = createIntl({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); const testPost = { message: 'test_message', @@ -675,8 +673,7 @@ describe('PostUtils.createAriaLabelForPost', () => { assert.ok(ariaLabel.indexOf('reply')); }); test('Should translate emoji into {emoji-name} emoji', () => { - const intlProvider = new IntlProvider({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); - const {intl} = intlProvider.getChildContext(); + const intl = createIntl({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {}); const testPost = { message: 'emoji_test :smile: :+1: :non-potable_water: :space emoji: :not_an_emoji:', diff --git a/utils/react_intl.ts b/utils/react_intl.ts index 7aab7a88f971..d45dc92afea9 100644 --- a/utils/react_intl.ts +++ b/utils/react_intl.ts @@ -21,7 +21,7 @@ export const intlConfigPropTypes = { export const intlFormatPropTypes = { formatDate: PropTypes.func.isRequired, formatTime: PropTypes.func.isRequired, - formatRelative: PropTypes.func.isRequired, + formatRelativeTime: PropTypes.func.isRequired, formatNumber: PropTypes.func.isRequired, formatPlural: PropTypes.func.isRequired, formatMessage: PropTypes.func.isRequired, @@ -32,5 +32,4 @@ export const intlShape = PropTypes.shape({ ...intlConfigPropTypes, ...intlFormatPropTypes, formatters: PropTypes.object, - now: PropTypes.func.isRequired, });