Compare commits
89 Commits
v10.2.2
...
Ali-Abbas/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59f72e13dd | ||
|
|
01ccaa6988 | ||
|
|
c0dd43ce4a | ||
|
|
56469df0b5 | ||
|
|
0de4ad621e | ||
|
|
5d50e59672 | ||
|
|
c715f0c4d4 | ||
|
|
a62124ddf2 | ||
|
|
8c222ddb0a | ||
|
|
b4031ce345 | ||
|
|
b787f5ecfe | ||
|
|
f87d47f42d | ||
|
|
818ed5d179 | ||
|
|
07eb5892da | ||
|
|
3b8b18051f | ||
|
|
1c719d63cb | ||
|
|
dc7d2fadff | ||
|
|
b710800b2a | ||
|
|
74ff35ae9a | ||
|
|
e6835f9c56 | ||
|
|
a0c19faa92 | ||
|
|
fa37ebb828 | ||
|
|
a24972b64f | ||
|
|
abb22a82ba | ||
|
|
1df0b94a8c | ||
|
|
d563e2f444 | ||
|
|
92a210f81d | ||
|
|
1b92a3c505 | ||
|
|
f88d47275b | ||
|
|
26f3900602 | ||
|
|
a9db712240 | ||
|
|
739cce6c50 | ||
|
|
3a19e219bb | ||
|
|
12511689e8 | ||
|
|
f084393cc9 | ||
|
|
4035ff122c | ||
|
|
159b5a842e | ||
|
|
b06c8b5d01 | ||
|
|
c79da49208 | ||
|
|
82b3310a8f | ||
|
|
fcd641259b | ||
|
|
509276df12 | ||
|
|
4527baef5a | ||
|
|
8183143ae5 | ||
|
|
91311f25da | ||
|
|
ccef5de855 | ||
|
|
01fa97055f | ||
|
|
3cff0970a3 | ||
|
|
f2c879999d | ||
|
|
3f18cf7c9d | ||
|
|
30796204b8 | ||
|
|
d206ecf3ad | ||
|
|
f3094e1725 | ||
|
|
5bbd266834 | ||
|
|
37eed0578f | ||
|
|
acbe489a7c | ||
|
|
2cfbb40265 | ||
|
|
3e1264b710 | ||
|
|
bf60da6554 | ||
|
|
cf879e53be | ||
|
|
e0a634900d | ||
|
|
15ae025990 | ||
|
|
efd85745fd | ||
|
|
fc5df4af36 | ||
|
|
f657c719ec | ||
|
|
6c346c18f9 | ||
|
|
2b9c5affbc | ||
|
|
4a13120d24 | ||
|
|
8e0587f871 | ||
|
|
7cc2f74562 | ||
|
|
3b13fc29b4 | ||
|
|
3f12c52221 | ||
|
|
826d071566 | ||
|
|
b66ae651b6 | ||
|
|
d23a4e2443 | ||
|
|
898b90eb07 | ||
|
|
dbb806d0a3 | ||
|
|
702bce8587 | ||
|
|
0bd6c9d452 | ||
|
|
3d4d356665 | ||
|
|
e656865502 | ||
|
|
2b4283ac5f | ||
|
|
38d9a2076b | ||
|
|
a31d1a5387 | ||
|
|
a374cee7dd | ||
|
|
3f50a4d333 | ||
|
|
45f0f20f0f | ||
|
|
fb06f7d9f9 | ||
|
|
9824aecd16 |
@@ -1,3 +1,4 @@
|
|||||||
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
const { createConfig } = require('@edx/frontend-build');
|
const { createConfig } = require('@edx/frontend-build');
|
||||||
|
|
||||||
module.exports = createConfig('eslint');
|
module.exports = createConfig('eslint');
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ jobs:
|
|||||||
secrets:
|
secrets:
|
||||||
GITHUB_APP_ID: ${{ secrets.GRAPHQL_AUTH_APP_ID }}
|
GITHUB_APP_ID: ${{ secrets.GRAPHQL_AUTH_APP_ID }}
|
||||||
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GRAPHQL_AUTH_APP_PEM }}
|
GITHUB_APP_PRIVATE_KEY: ${{ secrets.GRAPHQL_AUTH_APP_PEM }}
|
||||||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_ISSUE_BOT_TOKEN }}
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_ISSUE_BOT_TOKEN }}
|
||||||
|
|||||||
20
.github/workflows/add-remove-label-on-comment.yml
vendored
Normal file
20
.github/workflows/add-remove-label-on-comment.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# This workflow runs when a comment is made on the ticket
|
||||||
|
# If the comment starts with "label: " it tries to apply
|
||||||
|
# the label indicated in rest of comment.
|
||||||
|
# If the comment starts with "remove label: ", it tries
|
||||||
|
# to remove the indicated label.
|
||||||
|
# Note: Labels are allowed to have spaces and this script does
|
||||||
|
# not parse spaces (as often a space is legitimate), so the command
|
||||||
|
# "label: really long lots of words label" will apply the
|
||||||
|
# label "really long lots of words label"
|
||||||
|
|
||||||
|
name: Allows for the adding and removing of labels via comment
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add_remove_labels:
|
||||||
|
uses: openedx/.github/.github/workflows/add-remove-label-on-comment.yml@master
|
||||||
|
|
||||||
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
@@ -1,26 +1,25 @@
|
|||||||
name: Default CI
|
name: Default CI
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- '**'
|
- '**'
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node: [12, 14, 16]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
- name: Setup Nodejs Env
|
||||||
|
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
|
||||||
- name: Setup Nodejs
|
- name: Setup Nodejs
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ env.NODE_VER }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Validate package-lock.json changes
|
- name: Validate package-lock.json changes
|
||||||
@@ -29,7 +28,9 @@ jobs:
|
|||||||
run: npm run lint
|
run: npm run lint
|
||||||
- name: Test
|
- name: Test
|
||||||
run: npm run test
|
run: npm run test
|
||||||
|
- name: Build
|
||||||
|
run: npm run build
|
||||||
- name: i18n_extract
|
- name: i18n_extract
|
||||||
run: npm run i18n_extract
|
run: npm run i18n_extract
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@v3
|
||||||
|
|||||||
2
.github/workflows/commitlint.yml
vendored
2
.github/workflows/commitlint.yml
vendored
@@ -7,4 +7,4 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
commitlint:
|
commitlint:
|
||||||
uses: edx/.github/.github/workflows/commitlint.yml@master
|
uses: openedx/.github/.github/workflows/commitlint.yml@master
|
||||||
|
|||||||
13
.github/workflows/lockfileversion-check.yml
vendored
Normal file
13
.github/workflows/lockfileversion-check.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#check package-lock file version
|
||||||
|
|
||||||
|
name: Lockfile Version check
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
version-check:
|
||||||
|
uses: openedx/.github/.github/workflows/lockfileversion-check-v3.yml@master
|
||||||
58
.github/workflows/release.yml
vendored
58
.github/workflows/release.yml
vendored
@@ -2,36 +2,38 @@ name: Release CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup Node.js
|
- name: Setup Nodejs Env
|
||||||
uses: actions/setup-node@v2
|
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
|
||||||
with:
|
- name: Setup Node.js
|
||||||
node-version: 12
|
uses: actions/setup-node@v3
|
||||||
- name: Install dependencies
|
with:
|
||||||
run: npm ci
|
node-version: ${{ env.NODE_VER }}
|
||||||
- name: Validate package-lock.json changes
|
- name: Install dependencies
|
||||||
run: make validate-no-uncommitted-package-lock-changes
|
run: npm ci
|
||||||
- name: Lint
|
- name: Validate package-lock.json changes
|
||||||
run: npm run lint
|
run: make validate-no-uncommitted-package-lock-changes
|
||||||
- name: Test
|
- name: Lint
|
||||||
run: npm run test
|
run: npm run lint
|
||||||
- name: i18n_extract
|
- name: Test
|
||||||
run: npm run i18n_extract
|
run: npm run test
|
||||||
- name: Coverage
|
- name: i18n_extract
|
||||||
uses: codecov/codecov-action@v2
|
run: npm run i18n_extract
|
||||||
- name: Build
|
- name: Coverage
|
||||||
run: npm run build
|
uses: codecov/codecov-action@v3
|
||||||
- name: Release
|
- name: Build
|
||||||
env:
|
run: npm run build
|
||||||
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
|
- name: Release
|
||||||
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
|
env:
|
||||||
run: npx semantic-release
|
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
|
||||||
|
run: npx semantic-release
|
||||||
|
|||||||
12
.github/workflows/self-assign-issue.yml
vendored
Normal file
12
.github/workflows/self-assign-issue.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# This workflow runs when a comment is made on the ticket
|
||||||
|
# If the comment starts with "assign me" it assigns the author to the
|
||||||
|
# ticket (case insensitive)
|
||||||
|
|
||||||
|
name: Assign comment author to ticket if they say "assign me"
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
self_assign_by_comment:
|
||||||
|
uses: openedx/.github/.github/workflows/self-assign-issue.yml@master
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
[main]
|
[main]
|
||||||
host = https://www.transifex.com
|
host = https://www.transifex.com
|
||||||
|
|
||||||
[edx-platform.frontend-component-footer]
|
[o:open-edx:p:edx-platform:r:frontend-component-footer]
|
||||||
file_filter = src/i18n/messages/<lang>.json
|
file_filter = src/i18n/messages/<lang>.json
|
||||||
source_file = src/i18n/transifex_input.json
|
source_file = src/i18n/transifex_input.json
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = KEYVALUEJSON
|
type = KEYVALUEJSON
|
||||||
|
|
||||||
|
|||||||
14
Makefile
Executable file → Normal file
14
Makefile
Executable file → Normal file
@@ -1,11 +1,9 @@
|
|||||||
transifex_resource = frontend-component-footer
|
export TRANSIFEX_RESOURCE = frontend-component-footer
|
||||||
transifex_langs = "ar,fr,es_419,zh_CN"
|
transifex_langs = "ar,fr,es_419,zh_CN,pt,it,de,uk,ru,hi,fr_CA,it_IT,pt_PT,de_DE"
|
||||||
|
|
||||||
transifex_utils = ./node_modules/.bin/transifex-utils.js
|
transifex_utils = ./node_modules/.bin/transifex-utils.js
|
||||||
i18n = ./src/i18n
|
i18n = ./src/i18n
|
||||||
transifex_input = $(i18n)/transifex_input.json
|
transifex_input = $(i18n)/transifex_input.json
|
||||||
tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/translation/en/strings/
|
|
||||||
tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/source/
|
|
||||||
|
|
||||||
# This directory must match .babelrc .
|
# This directory must match .babelrc .
|
||||||
transifex_temp = ./temp/babel-plugin-react-intl
|
transifex_temp = ./temp/babel-plugin-react-intl
|
||||||
@@ -42,15 +40,15 @@ push_translations:
|
|||||||
# Pushing strings to Transifex...
|
# Pushing strings to Transifex...
|
||||||
tx push -s
|
tx push -s
|
||||||
# Fetching hashes from Transifex...
|
# Fetching hashes from Transifex...
|
||||||
./node_modules/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1)
|
./node_modules/@edx/reactifex/bash_scripts/get_hashed_strings_v3.sh
|
||||||
# Writing out comments to file...
|
# Writing out comments to file...
|
||||||
$(transifex_utils) $(transifex_temp) --comments
|
$(transifex_utils) $(transifex_temp) --comments --v3-scripts-path
|
||||||
# Pushing comments to Transifex...
|
# Pushing comments to Transifex...
|
||||||
./node_modules/reactifex/bash_scripts/put_comments.sh $(tx_url2)
|
./node_modules/@edx/reactifex/bash_scripts/put_comments_v3.sh
|
||||||
|
|
||||||
# Pulls translations from Transifex.
|
# Pulls translations from Transifex.
|
||||||
pull_translations:
|
pull_translations:
|
||||||
tx pull -f --mode reviewed --language=$(transifex_langs)
|
tx pull -t -f --mode reviewed --languages=$(transifex_langs)
|
||||||
|
|
||||||
# This target is used by Travis.
|
# This target is used by Travis.
|
||||||
validate-no-uncommitted-package-lock-changes:
|
validate-no-uncommitted-package-lock-changes:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ A generic footer for Open edX micro-frontend applications. It includes a logo a
|
|||||||
Requirements
|
Requirements
|
||||||
************
|
************
|
||||||
|
|
||||||
This component uses ``@edx/frontend-platform`` services such as i18n, analytics, configuration, and the ``AppContext`` React component, and expects that it has been loaded into a micro-frontend that has been properly initialized via ``@edx/frontend-platform``'s ``initialize`` function. `Please visit the frontend template application to see an example. <https://github.com/edx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx>`_
|
This component uses ``@edx/frontend-platform`` services such as i18n, analytics, configuration, and the ``AppContext`` React component, and expects that it has been loaded into a micro-frontend that has been properly initialized via ``@edx/frontend-platform``'s ``initialize`` function. `Please visit the frontend template application to see an example. <https://github.com/openedx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx>`_
|
||||||
|
|
||||||
Environment Variables
|
Environment Variables
|
||||||
=====================
|
=====================
|
||||||
@@ -68,8 +68,8 @@ Component Usage Example::
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
* `An example of minimal component and messages usage. <https://github.com/edx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx#L23>`_
|
* `An example of minimal component and messages usage. <https://github.com/openedx/frontend-template-application/blob/3355bb3a96232390e9056f35b06ffa8f105ed7ca/src/index.jsx#L23>`_
|
||||||
* `An example of SCSS file usage. <https://github.com/edx/frontend-template-application/blob/3cd5485bf387b8c479baf6b02bf59e3061dc3465/src/index.scss#L9>`_
|
* `An example of SCSS file usage. <https://github.com/openedx/frontend-template-application/blob/3cd5485bf387b8c479baf6b02bf59e3061dc3465/src/index.scss#L9>`_
|
||||||
|
|
||||||
***********
|
***********
|
||||||
Development
|
Development
|
||||||
|
|||||||
36099
package-lock.json
generated
36099
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
47
package.json
47
package.json
@@ -24,44 +24,43 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/edx/frontend-component-footer.git"
|
"url": "git+https://github.com/openedx/frontend-component-footer.git"
|
||||||
},
|
},
|
||||||
"author": "edX",
|
"author": "edX",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/edx/frontend-component-footer/issues"
|
"url": "https://github.com/openedx/frontend-component-footer/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/edx/frontend-component-footer#readme",
|
"homepage": "https://github.com/openedx/frontend-component-footer#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
|
"@edx/brand": "npm:@edx/brand-openedx@1.2.0",
|
||||||
"@edx/frontend-build": "9.1.2",
|
"@edx/browserslist-config": "^1.1.1",
|
||||||
"@edx/frontend-platform": "^1.15.1",
|
"@edx/frontend-build": "12.7.0",
|
||||||
"@edx/paragon": "^19.6.0",
|
"@edx/paragon": "^20.19.0",
|
||||||
"codecov": "3.8.3",
|
"@edx/reactifex": "^2.1.1",
|
||||||
"enzyme": "3.11.0",
|
"enzyme": "3.11.0",
|
||||||
"enzyme-adapter-react-16": "1.15.6",
|
"enzyme-adapter-react-16": "1.15.7",
|
||||||
"husky": "7.0.4",
|
"husky": "8.0.3",
|
||||||
"prop-types": "15.7.2",
|
"prop-types": "15.8.1",
|
||||||
"react": "16.14.0",
|
"react": "16.14.0",
|
||||||
"react-dom": "16.14.0",
|
"react-dom": "16.14.0",
|
||||||
"react-redux": "7.2.6",
|
"react-redux": "7.2.9",
|
||||||
"react-router-dom": "5.3.0",
|
"react-router-dom": "5.3.4",
|
||||||
"react-test-renderer": "16.14.0",
|
"react-test-renderer": "16.14.0",
|
||||||
"reactifex": "1.1.1",
|
"redux": "4.2.1",
|
||||||
"redux": "4.1.2",
|
"semantic-release": "19.0.5"
|
||||||
"semantic-release": "^17.0.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-svg-core": "1.2.36",
|
"@edx/frontend-platform": "^4.1.0",
|
||||||
"@fortawesome/free-brands-svg-icons": "5.15.4",
|
"@fortawesome/fontawesome-svg-core": "6.4.0",
|
||||||
"@fortawesome/free-regular-svg-icons": "5.15.4",
|
"@fortawesome/free-brands-svg-icons": "6.4.0",
|
||||||
"@fortawesome/free-solid-svg-icons": "5.15.4",
|
"@fortawesome/free-regular-svg-icons": "6.4.0",
|
||||||
"@fortawesome/react-fontawesome": "0.1.16"
|
"@fortawesome/free-solid-svg-icons": "6.4.0",
|
||||||
|
"@fortawesome/react-fontawesome": "0.2.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@edx/frontend-platform": "^1.8.0",
|
|
||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.5.10",
|
||||||
"react": "^16.9.0",
|
"react": "^16.9.0 || ^17.0.0",
|
||||||
"react-dom": "^16.9.0"
|
"react-dom": "^16.9.0 || ^17.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,11 @@
|
|||||||
"pin"
|
"pin"
|
||||||
],
|
],
|
||||||
"automerge": true
|
"automerge": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackagePatterns": ["@edx"],
|
||||||
|
"matchUpdateTypes": ["minor", "patch"],
|
||||||
|
"automerge": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"timezone": "America/New_York"
|
"timezone": "America/New_York"
|
||||||
|
|||||||
@@ -23,14 +23,6 @@ class SiteFooter extends React.Component {
|
|||||||
this.externalLinkClickHandler = this.externalLinkClickHandler.bind(this);
|
this.externalLinkClickHandler = this.externalLinkClickHandler.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLocalePrefix(locale) {
|
|
||||||
const twoLetterPrefix = locale.substring(0, 2).toLowerCase();
|
|
||||||
if (twoLetterPrefix === 'en') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return `/${twoLetterPrefix}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
externalLinkClickHandler(event) {
|
externalLinkClickHandler(event) {
|
||||||
const label = event.currentTarget.getAttribute('href');
|
const label = event.currentTarget.getAttribute('href');
|
||||||
const eventName = EVENT_NAMES.FOOTER_LINK;
|
const eventName = EVENT_NAMES.FOOTER_LINK;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React from 'react';
|
/* eslint-disable react/prop-types */
|
||||||
|
import React, { useMemo } from 'react';
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||||
@@ -6,71 +7,69 @@ import { AppContext } from '@edx/frontend-platform/react';
|
|||||||
|
|
||||||
import Footer from './Footer';
|
import Footer from './Footer';
|
||||||
|
|
||||||
|
const FooterWithContext = ({ locale = 'es' }) => {
|
||||||
|
const contextValue = useMemo(() => ({
|
||||||
|
authenticatedUser: null,
|
||||||
|
config: {
|
||||||
|
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
||||||
|
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
||||||
|
},
|
||||||
|
}), []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IntlProvider locale={locale}>
|
||||||
|
<AppContext.Provider
|
||||||
|
value={contextValue}
|
||||||
|
>
|
||||||
|
<Footer />
|
||||||
|
</AppContext.Provider>
|
||||||
|
</IntlProvider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const FooterWithLanguageSelector = ({ languageSelected = () => {} }) => {
|
||||||
|
const contextValue = useMemo(() => ({
|
||||||
|
authenticatedUser: null,
|
||||||
|
config: {
|
||||||
|
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
||||||
|
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
||||||
|
},
|
||||||
|
}), []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<IntlProvider locale="en">
|
||||||
|
<AppContext.Provider
|
||||||
|
value={contextValue}
|
||||||
|
>
|
||||||
|
<Footer
|
||||||
|
onLanguageSelected={languageSelected}
|
||||||
|
supportedLanguages={[
|
||||||
|
{ label: 'English', value: 'en' },
|
||||||
|
{ label: 'Español', value: 'es' },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</AppContext.Provider>
|
||||||
|
</IntlProvider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
describe('<Footer />', () => {
|
describe('<Footer />', () => {
|
||||||
describe('renders correctly', () => {
|
describe('renders correctly', () => {
|
||||||
it('renders without a language selector', () => {
|
it('renders without a language selector', () => {
|
||||||
const tree = renderer
|
const tree = renderer
|
||||||
.create((
|
.create(<FooterWithContext locale="en" />)
|
||||||
<IntlProvider locale="en">
|
|
||||||
<AppContext.Provider
|
|
||||||
value={{
|
|
||||||
authenticatedUser: null,
|
|
||||||
config: {
|
|
||||||
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
|
||||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Footer />
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
))
|
|
||||||
.toJSON();
|
.toJSON();
|
||||||
expect(tree).toMatchSnapshot();
|
expect(tree).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
it('renders without a language selector in es', () => {
|
it('renders without a language selector in es', () => {
|
||||||
const tree = renderer
|
const tree = renderer
|
||||||
.create((
|
.create(<FooterWithContext locale="es" />)
|
||||||
<IntlProvider locale="es">
|
|
||||||
<AppContext.Provider
|
|
||||||
value={{
|
|
||||||
authenticatedUser: null,
|
|
||||||
config: {
|
|
||||||
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
|
||||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Footer />
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
))
|
|
||||||
.toJSON();
|
.toJSON();
|
||||||
expect(tree).toMatchSnapshot();
|
expect(tree).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
it('renders with a language selector', () => {
|
it('renders with a language selector', () => {
|
||||||
const tree = renderer
|
const tree = renderer
|
||||||
.create((
|
.create(<FooterWithLanguageSelector />)
|
||||||
<IntlProvider locale="en">
|
|
||||||
<AppContext.Provider
|
|
||||||
value={{
|
|
||||||
authenticatedUser: null,
|
|
||||||
config: {
|
|
||||||
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
|
||||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Footer
|
|
||||||
onLanguageSelected={() => {}}
|
|
||||||
supportedLanguages={[
|
|
||||||
{ label: 'English', value: 'en' },
|
|
||||||
{ label: 'Español', value: 'es' },
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
))
|
|
||||||
.toJSON();
|
.toJSON();
|
||||||
expect(tree).toMatchSnapshot();
|
expect(tree).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
@@ -79,27 +78,7 @@ describe('<Footer />', () => {
|
|||||||
describe('handles language switching', () => {
|
describe('handles language switching', () => {
|
||||||
it('calls onLanguageSelected prop when a language is changed', () => {
|
it('calls onLanguageSelected prop when a language is changed', () => {
|
||||||
const mockHandleLanguageSelected = jest.fn();
|
const mockHandleLanguageSelected = jest.fn();
|
||||||
const wrapper = mount((
|
const wrapper = mount(<FooterWithLanguageSelector languageSelected={mockHandleLanguageSelected} />);
|
||||||
<IntlProvider locale="en">
|
|
||||||
<AppContext.Provider
|
|
||||||
value={{
|
|
||||||
authenticatedUser: null,
|
|
||||||
config: {
|
|
||||||
LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,
|
|
||||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Footer
|
|
||||||
onLanguageSelected={mockHandleLanguageSelected}
|
|
||||||
supportedLanguages={[
|
|
||||||
{ label: 'English', value: 'en' },
|
|
||||||
{ label: 'Español', value: 'es' },
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</AppContext.Provider>
|
|
||||||
</IntlProvider>
|
|
||||||
));
|
|
||||||
|
|
||||||
wrapper.find('form').simulate('submit', {
|
wrapper.find('form').simulate('submit', {
|
||||||
target: {
|
target: {
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ exports[`<Footer /> renders correctly renders with a language selector 1`] = `
|
|||||||
className="d-inline-block m-0"
|
className="d-inline-block m-0"
|
||||||
htmlFor="site-footer-language-select"
|
htmlFor="site-footer-language-select"
|
||||||
>
|
>
|
||||||
<span>
|
Choose Language
|
||||||
Choose Language
|
|
||||||
</span>
|
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
className="form-control-sm mx-2"
|
className="form-control-sm mx-2"
|
||||||
@@ -62,9 +60,7 @@ exports[`<Footer /> renders correctly renders with a language selector 1`] = `
|
|||||||
className="btn btn-outline-primary btn-sm"
|
className="btn btn-outline-primary btn-sm"
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
<span>
|
Apply
|
||||||
Apply
|
|
||||||
</span>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,32 +1,34 @@
|
|||||||
import arMessages from './messages/ar.json';
|
import arMessages from './messages/ar.json';
|
||||||
import caMessages from './messages/ca.json';
|
|
||||||
// no need to import en messages-- they are in the defaultMessage field
|
|
||||||
import es419Messages from './messages/es_419.json';
|
|
||||||
import frMessages from './messages/fr.json';
|
import frMessages from './messages/fr.json';
|
||||||
|
import es419Messages from './messages/es_419.json';
|
||||||
import zhcnMessages from './messages/zh_CN.json';
|
import zhcnMessages from './messages/zh_CN.json';
|
||||||
import heMessages from './messages/he.json';
|
import ptMessages from './messages/pt.json';
|
||||||
import idMessages from './messages/id.json';
|
import itMessages from './messages/it.json';
|
||||||
import kokrMessages from './messages/ko_kr.json';
|
|
||||||
import plMessages from './messages/pl.json';
|
|
||||||
import ptbrMessages from './messages/pt_br.json';
|
|
||||||
import ruMessages from './messages/ru.json';
|
|
||||||
import thMessages from './messages/th.json';
|
|
||||||
import ukMessages from './messages/uk.json';
|
import ukMessages from './messages/uk.json';
|
||||||
|
import deMessages from './messages/de.json';
|
||||||
|
import ruMessages from './messages/ru.json';
|
||||||
|
import hiMessages from './messages/hi.json';
|
||||||
|
import frCAMessages from './messages/fr_CA.json';
|
||||||
|
import dedeCAMessages from './messages/de_DE.json';
|
||||||
|
import ititCAMessages from './messages/it_IT.json';
|
||||||
|
import ptptCAMessages from './messages/pt_PT.json';
|
||||||
|
// no need to import en messages-- they are in the defaultMessage field
|
||||||
|
|
||||||
const messages = {
|
const messages = {
|
||||||
ar: arMessages,
|
ar: arMessages,
|
||||||
'es-419': es419Messages,
|
'es-419': es419Messages,
|
||||||
fr: frMessages,
|
fr: frMessages,
|
||||||
'zh-cn': zhcnMessages,
|
'zh-cn': zhcnMessages,
|
||||||
ca: caMessages,
|
pt: ptMessages,
|
||||||
he: heMessages,
|
it: itMessages,
|
||||||
id: idMessages,
|
de: deMessages,
|
||||||
'ko-kr': kokrMessages,
|
hi: hiMessages,
|
||||||
pl: plMessages,
|
'fr-ca': frCAMessages,
|
||||||
'pt-br': ptbrMessages,
|
|
||||||
ru: ruMessages,
|
ru: ruMessages,
|
||||||
th: thMessages,
|
|
||||||
uk: ukMessages,
|
uk: ukMessages,
|
||||||
|
'de-de': dedeCAMessages,
|
||||||
|
'it-it': ititCAMessages,
|
||||||
|
'pt-pt': ptptCAMessages,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default messages;
|
export default messages;
|
||||||
|
|||||||
@@ -1,32 +1 @@
|
|||||||
{
|
{}
|
||||||
"footer.socialLinks.srText.facebook": "Like edX on Facebook",
|
|
||||||
"footer.socialLinks.srText.twitter": "Follow edX on Twitter",
|
|
||||||
"footer.socialLinks.srText.youtube": "Subscribe to the edX YouTube channel",
|
|
||||||
"footer.socialLinks.srText.linkedin": "Follow edX on LinkedIn",
|
|
||||||
"footer.socialLinks.srText.reddit": "Subscribe to the edX subreddit",
|
|
||||||
"footer.languageForm.select.label": "Choose Language",
|
|
||||||
"footer.languageForm.submit.label": "Apply",
|
|
||||||
"footer.edxLinks.about": "About",
|
|
||||||
"footer.edxLinks.business": "edX for Business",
|
|
||||||
"footer.edxLinks.affiliates": "Affiliates",
|
|
||||||
"footer.edxLinks.openEdx": "Open edX",
|
|
||||||
"footer.edxLinks.careers": "Careers",
|
|
||||||
"footer.edxLinks.news": "News",
|
|
||||||
"footer.legalLinks.heading": "Legal",
|
|
||||||
"footer.legalLinks.termsOfService": "Terms of Service & Honor Code",
|
|
||||||
"footer.legalLinks.privacyPolicy": "Privacy Policy",
|
|
||||||
"footer.legalLinks.a11yPolicy": "Accessibility Policy",
|
|
||||||
"footer.legalLinks.trademarkPolicy": "Trademark Policy",
|
|
||||||
"footer.legalLinks.sitemap": "Sitemap",
|
|
||||||
"footer.connectLinks.heading": "Connect",
|
|
||||||
"footer.connectLinks.blog": "Blog",
|
|
||||||
"footer.connectLinks.contact": "Contact Us",
|
|
||||||
"footer.connectLinks.help": "Help Center",
|
|
||||||
"footer.connectLinks.mediaKit": "Media Kit",
|
|
||||||
"footer.connectLinks.donate": "Donate",
|
|
||||||
"footer.mobileApp.apple": "Download the edX mobile app from the Apple App Store",
|
|
||||||
"footer.mobileApp.google": "Download the edX mobile app from Google Play",
|
|
||||||
"footer.logo.altText": "Powered by Open edX",
|
|
||||||
"footer.logo.ariaLabel": "edX Home",
|
|
||||||
"footer.ariaLabel": "Page Footer"
|
|
||||||
}
|
|
||||||
@@ -1,32 +1 @@
|
|||||||
{
|
{}
|
||||||
"footer.socialLinks.srText.facebook": "Like edX on Facebook",
|
|
||||||
"footer.socialLinks.srText.twitter": "Follow edX on Twitter",
|
|
||||||
"footer.socialLinks.srText.youtube": "Subscribe to the edX YouTube channel",
|
|
||||||
"footer.socialLinks.srText.linkedin": "Follow edX on LinkedIn",
|
|
||||||
"footer.socialLinks.srText.reddit": "Subscribe to the edX subreddit",
|
|
||||||
"footer.languageForm.select.label": "Choose Language",
|
|
||||||
"footer.languageForm.submit.label": "Apply",
|
|
||||||
"footer.edxLinks.about": "About",
|
|
||||||
"footer.edxLinks.business": "edX for Business",
|
|
||||||
"footer.edxLinks.affiliates": "Affiliates",
|
|
||||||
"footer.edxLinks.openEdx": "Open edX",
|
|
||||||
"footer.edxLinks.careers": "Careers",
|
|
||||||
"footer.edxLinks.news": "News",
|
|
||||||
"footer.legalLinks.heading": "Legal",
|
|
||||||
"footer.legalLinks.termsOfService": "Terms of Service & Honor Code",
|
|
||||||
"footer.legalLinks.privacyPolicy": "Privacy Policy",
|
|
||||||
"footer.legalLinks.a11yPolicy": "Accessibility Policy",
|
|
||||||
"footer.legalLinks.trademarkPolicy": "Trademark Policy",
|
|
||||||
"footer.legalLinks.sitemap": "Sitemap",
|
|
||||||
"footer.connectLinks.heading": "Connect",
|
|
||||||
"footer.connectLinks.blog": "Blog",
|
|
||||||
"footer.connectLinks.contact": "Contact Us",
|
|
||||||
"footer.connectLinks.help": "Help Center",
|
|
||||||
"footer.connectLinks.mediaKit": "Media Kit",
|
|
||||||
"footer.connectLinks.donate": "Donate",
|
|
||||||
"footer.mobileApp.apple": "Download the edX mobile app from the Apple App Store",
|
|
||||||
"footer.mobileApp.google": "Download the edX mobile app from Google Play",
|
|
||||||
"footer.logo.altText": "Powered by Open edX",
|
|
||||||
"footer.logo.ariaLabel": "edX Home",
|
|
||||||
"footer.ariaLabel": "Page Footer"
|
|
||||||
}
|
|
||||||
@@ -1,32 +1 @@
|
|||||||
{
|
{}
|
||||||
"footer.socialLinks.srText.facebook": "Like edX on Facebook",
|
|
||||||
"footer.socialLinks.srText.twitter": "Follow edX on Twitter",
|
|
||||||
"footer.socialLinks.srText.youtube": "Subscribe to the edX YouTube channel",
|
|
||||||
"footer.socialLinks.srText.linkedin": "Follow edX on LinkedIn",
|
|
||||||
"footer.socialLinks.srText.reddit": "Subscribe to the edX subreddit",
|
|
||||||
"footer.languageForm.select.label": "Choose Language",
|
|
||||||
"footer.languageForm.submit.label": "Apply",
|
|
||||||
"footer.edxLinks.about": "About",
|
|
||||||
"footer.edxLinks.business": "edX for Business",
|
|
||||||
"footer.edxLinks.affiliates": "Affiliates",
|
|
||||||
"footer.edxLinks.openEdx": "Open edX",
|
|
||||||
"footer.edxLinks.careers": "Careers",
|
|
||||||
"footer.edxLinks.news": "News",
|
|
||||||
"footer.legalLinks.heading": "Legal",
|
|
||||||
"footer.legalLinks.termsOfService": "Terms of Service & Honor Code",
|
|
||||||
"footer.legalLinks.privacyPolicy": "Privacy Policy",
|
|
||||||
"footer.legalLinks.a11yPolicy": "Accessibility Policy",
|
|
||||||
"footer.legalLinks.trademarkPolicy": "Trademark Policy",
|
|
||||||
"footer.legalLinks.sitemap": "Sitemap",
|
|
||||||
"footer.connectLinks.heading": "Connect",
|
|
||||||
"footer.connectLinks.blog": "Blog",
|
|
||||||
"footer.connectLinks.contact": "Contact Us",
|
|
||||||
"footer.connectLinks.help": "Help Center",
|
|
||||||
"footer.connectLinks.mediaKit": "Media Kit",
|
|
||||||
"footer.connectLinks.donate": "Donate",
|
|
||||||
"footer.mobileApp.apple": "Download the edX mobile app from the Apple App Store",
|
|
||||||
"footer.mobileApp.google": "Download the edX mobile app from Google Play",
|
|
||||||
"footer.logo.altText": "Powered by Open edX",
|
|
||||||
"footer.logo.ariaLabel": "edX Home",
|
|
||||||
"footer.ariaLabel": "Page Footer"
|
|
||||||
}
|
|
||||||
1
src/i18n/messages/pt_PT.json
Normal file
1
src/i18n/messages/pt_PT.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@@ -1,32 +1 @@
|
|||||||
{
|
{}
|
||||||
"footer.socialLinks.srText.facebook": "Like edX on Facebook",
|
|
||||||
"footer.socialLinks.srText.twitter": "Follow edX on Twitter",
|
|
||||||
"footer.socialLinks.srText.youtube": "Subscribe to the edX YouTube channel",
|
|
||||||
"footer.socialLinks.srText.linkedin": "Follow edX on LinkedIn",
|
|
||||||
"footer.socialLinks.srText.reddit": "Subscribe to the edX subreddit",
|
|
||||||
"footer.languageForm.select.label": "Choose Language",
|
|
||||||
"footer.languageForm.submit.label": "Apply",
|
|
||||||
"footer.edxLinks.about": "About",
|
|
||||||
"footer.edxLinks.business": "edX for Business",
|
|
||||||
"footer.edxLinks.affiliates": "Affiliates",
|
|
||||||
"footer.edxLinks.openEdx": "Open edX",
|
|
||||||
"footer.edxLinks.careers": "Careers",
|
|
||||||
"footer.edxLinks.news": "News",
|
|
||||||
"footer.legalLinks.heading": "Legal",
|
|
||||||
"footer.legalLinks.termsOfService": "Terms of Service & Honor Code",
|
|
||||||
"footer.legalLinks.privacyPolicy": "Privacy Policy",
|
|
||||||
"footer.legalLinks.a11yPolicy": "Accessibility Policy",
|
|
||||||
"footer.legalLinks.trademarkPolicy": "Trademark Policy",
|
|
||||||
"footer.legalLinks.sitemap": "Sitemap",
|
|
||||||
"footer.connectLinks.heading": "Connect",
|
|
||||||
"footer.connectLinks.blog": "Blog",
|
|
||||||
"footer.connectLinks.contact": "Contact Us",
|
|
||||||
"footer.connectLinks.help": "Help Center",
|
|
||||||
"footer.connectLinks.mediaKit": "Media Kit",
|
|
||||||
"footer.connectLinks.donate": "Donate",
|
|
||||||
"footer.mobileApp.apple": "Download the edX mobile app from the Apple App Store",
|
|
||||||
"footer.mobileApp.google": "Download the edX mobile app from Google Play",
|
|
||||||
"footer.logo.altText": "Powered by Open edX",
|
|
||||||
"footer.logo.ariaLabel": "edX Home",
|
|
||||||
"footer.ariaLabel": "Page Footer"
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user