Merge branch 'master' of github.com:openedx/frontend-app-gradebook into mashal-m/replace-edx/paragon-frontend-build
This commit is contained in:
5
Makefile
5
Makefile
@@ -65,13 +65,14 @@ pull_translations:
|
||||
rm -rf src/i18n/messages
|
||||
mkdir src/i18n/messages
|
||||
cd src/i18n/messages \
|
||||
&& atlas pull --filter=$(transifex_langs) \
|
||||
&& atlas pull $(ATLAS_OPTIONS) \
|
||||
translations/frontend-component-footer/src/i18n/messages:frontend-component-footer \
|
||||
translations/frontend-component-header/src/i18n/messages:frontend-component-header \
|
||||
translations/frontend-platform/src/i18n/messages:frontend-platform \
|
||||
translations/paragon/src/i18n/messages:paragon \
|
||||
translations/frontend-app-gradebook/src/i18n/messages:frontend-app-gradebook
|
||||
|
||||
$(intl_imports) paragon frontend-component-header frontend-component-footer frontend-app-gradebook
|
||||
$(intl_imports) frontend-platform paragon frontend-component-header frontend-component-footer frontend-app-gradebook
|
||||
endif
|
||||
|
||||
# This target is used by CI.
|
||||
|
||||
@@ -5,9 +5,6 @@ module.exports = createConfig('jest', {
|
||||
'<rootDir>/src/setupTest.js',
|
||||
],
|
||||
modulePaths: ['<rootDir>/src/'],
|
||||
snapshotSerializers: [
|
||||
'enzyme-to-json/serializer',
|
||||
],
|
||||
coveragePathIgnorePatterns: [
|
||||
'src/segment.js',
|
||||
'src/postcss.config.js',
|
||||
|
||||
332
package-lock.json
generated
332
package-lock.json
generated
@@ -13,6 +13,7 @@
|
||||
"@edx/frontend-component-footer": "13.0.2",
|
||||
"@edx/frontend-component-header": "5.0.2",
|
||||
"@edx/frontend-platform": "7.1.0",
|
||||
"@edx/openedx-atlas": "^0.6.0",
|
||||
"@edx/react-unit-test-utils": "2.0.0",
|
||||
"@edx/reactifex": "^2.1.1",
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.25",
|
||||
@@ -25,8 +26,6 @@
|
||||
"classnames": "^2.2.6",
|
||||
"core-js": "3.6.5",
|
||||
"email-prop-type": "^1.1.7",
|
||||
"enzyme": "^3.10.0",
|
||||
"enzyme-to-json": "^3.6.2",
|
||||
"font-awesome": "4.7.0",
|
||||
"history": "4.10.1",
|
||||
"prop-types": "15.8.1",
|
||||
@@ -51,7 +50,6 @@
|
||||
"@edx/browserslist-config": "^1.1.1",
|
||||
"@openedx/frontend-build": "13.0.28",
|
||||
"@testing-library/react": "12.1.5",
|
||||
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
|
||||
"axios": "0.21.2",
|
||||
"axios-mock-adapter": "^1.17.0",
|
||||
"es-check": "^2.3.0",
|
||||
@@ -2534,6 +2532,14 @@
|
||||
"@newrelic/publish-sourcemap": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@edx/openedx-atlas": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@edx/openedx-atlas/-/openedx-atlas-0.6.0.tgz",
|
||||
"integrity": "sha512-wZO7hA4VJ/bXjaQNNR7KXGYyTCNs1mBJd3HwQK2EmOwFZYFNX6nzSAm9S7HCfi/kb1PCRpmp3wJt+v/Eu9BEQg==",
|
||||
"bin": {
|
||||
"atlas": "atlas"
|
||||
}
|
||||
},
|
||||
"node_modules/@edx/react-unit-test-utils": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@edx/react-unit-test-utils/-/react-unit-test-utils-2.0.0.tgz",
|
||||
@@ -5121,14 +5127,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/cheerio": {
|
||||
"version": "0.22.35",
|
||||
"resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.35.tgz",
|
||||
"integrity": "sha512-yD57BchKRvTV+JD53UZ6PD8KWY5g5rvvMLRnZR3EQBCZXiDT/HR+pKpMzFGlWNhFrXlo7VPZXtKvIEwZkAWOIA==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/connect": {
|
||||
"version": "3.4.38",
|
||||
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",
|
||||
@@ -5674,46 +5672,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@wojtekmaj/enzyme-adapter-react-17": {
|
||||
"version": "0.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@wojtekmaj/enzyme-adapter-react-17/-/enzyme-adapter-react-17-0.8.0.tgz",
|
||||
"integrity": "sha512-zeUGfQRziXW7R7skzNuJyi01ZwuKCH8WiBNnTgUJwdS/CURrJwAhWsfW7nG7E30ak8Pu3ZwD9PlK9skBfAoOBw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@wojtekmaj/enzyme-adapter-utils": "^0.2.0",
|
||||
"enzyme-shallow-equal": "^1.0.0",
|
||||
"has": "^1.0.0",
|
||||
"prop-types": "^15.7.0",
|
||||
"react-is": "^17.0.0",
|
||||
"react-test-renderer": "^17.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/wojtekmaj/enzyme-adapter-react-17?sponsor=1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"enzyme": "^3.0.0",
|
||||
"react": "^17.0.0-0",
|
||||
"react-dom": "^17.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@wojtekmaj/enzyme-adapter-utils": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@wojtekmaj/enzyme-adapter-utils/-/enzyme-adapter-utils-0.2.0.tgz",
|
||||
"integrity": "sha512-ZvZm9kZxZEKAbw+M1/Q3iDuqQndVoN8uLnxZ8bzxm7KgGTBejrGRoJAp8f1EN8eoO3iAjBNEQnTDW/H4Ekb0FQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"function.prototype.name": "^1.1.0",
|
||||
"has": "^1.0.0",
|
||||
"object.fromentries": "^2.0.0",
|
||||
"prop-types": "^15.7.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/wojtekmaj/enzyme-adapter-utils?sponsor=1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^17.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@xtuc/ieee754": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
|
||||
@@ -6130,24 +6088,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/array.prototype.filter": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.3.tgz",
|
||||
"integrity": "sha512-VizNcj/RGJiUyQBgzwxzE5oHdeuXY5hSbbmKMlphj1cy1Vl7Pn2asCGbSrru6hSQjmCzqTBPVWAF/whmEOVHbw==",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.2.0",
|
||||
"es-abstract": "^1.22.1",
|
||||
"es-array-method-boxes-properly": "^1.0.0",
|
||||
"is-string": "^1.0.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/array.prototype.flat": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz",
|
||||
@@ -7305,42 +7245,6 @@
|
||||
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
|
||||
"integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA=="
|
||||
},
|
||||
"node_modules/cheerio": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==",
|
||||
"dependencies": {
|
||||
"cheerio-select": "^2.1.0",
|
||||
"dom-serializer": "^2.0.0",
|
||||
"domhandler": "^5.0.3",
|
||||
"domutils": "^3.0.1",
|
||||
"htmlparser2": "^8.0.1",
|
||||
"parse5": "^7.0.0",
|
||||
"parse5-htmlparser2-tree-adapter": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/cheeriojs/cheerio?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/cheerio-select": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz",
|
||||
"integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==",
|
||||
"dependencies": {
|
||||
"boolbase": "^1.0.0",
|
||||
"css-select": "^5.1.0",
|
||||
"css-what": "^6.1.0",
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.3",
|
||||
"domutils": "^3.0.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
},
|
||||
"node_modules/child_process": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/child_process/-/child_process-1.0.2.tgz",
|
||||
@@ -8839,11 +8743,6 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/discontinuous-range": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz",
|
||||
"integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ=="
|
||||
},
|
||||
"node_modules/dns-packet": {
|
||||
"version": "5.6.1",
|
||||
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz",
|
||||
@@ -9233,71 +9132,6 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/enzyme": {
|
||||
"version": "3.11.0",
|
||||
"resolved": "https://registry.npmjs.org/enzyme/-/enzyme-3.11.0.tgz",
|
||||
"integrity": "sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw==",
|
||||
"dependencies": {
|
||||
"array.prototype.flat": "^1.2.3",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"enzyme-shallow-equal": "^1.0.1",
|
||||
"function.prototype.name": "^1.1.2",
|
||||
"has": "^1.0.3",
|
||||
"html-element-map": "^1.2.0",
|
||||
"is-boolean-object": "^1.0.1",
|
||||
"is-callable": "^1.1.5",
|
||||
"is-number-object": "^1.0.4",
|
||||
"is-regex": "^1.0.5",
|
||||
"is-string": "^1.0.5",
|
||||
"is-subset": "^0.1.1",
|
||||
"lodash.escape": "^4.0.1",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"object-inspect": "^1.7.0",
|
||||
"object-is": "^1.0.2",
|
||||
"object.assign": "^4.1.0",
|
||||
"object.entries": "^1.1.1",
|
||||
"object.values": "^1.1.1",
|
||||
"raf": "^3.4.1",
|
||||
"rst-selector-parser": "^2.2.3",
|
||||
"string.prototype.trim": "^1.2.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/enzyme-shallow-equal": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.5.tgz",
|
||||
"integrity": "sha512-i6cwm7hN630JXenxxJFBKzgLC3hMTafFQXflvzHgPmDhOBhxUWDe8AeRv1qp2/uWJ2Y8z5yLWMzmAfkTOiOCZg==",
|
||||
"dependencies": {
|
||||
"has": "^1.0.3",
|
||||
"object-is": "^1.1.5"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/enzyme-to-json": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/enzyme-to-json/-/enzyme-to-json-3.6.2.tgz",
|
||||
"integrity": "sha512-Ynm6Z6R6iwQ0g2g1YToz6DWhxVnt8Dy1ijR2zynRKxTyBGA8rCDXU3rs2Qc4OKvUvc2Qoe1bcFK6bnPs20TrTg==",
|
||||
"dependencies": {
|
||||
"@types/cheerio": "^0.22.22",
|
||||
"lodash": "^4.17.21",
|
||||
"react-is": "^16.12.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"enzyme": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/enzyme-to-json/node_modules/react-is": {
|
||||
"version": "16.13.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||
},
|
||||
"node_modules/error-ex": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
||||
@@ -9366,11 +9200,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/es-array-method-boxes-properly": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz",
|
||||
"integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA=="
|
||||
},
|
||||
"node_modules/es-check": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-check/-/es-check-2.3.0.tgz",
|
||||
@@ -11724,18 +11553,6 @@
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/html-element-map": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/html-element-map/-/html-element-map-1.3.1.tgz",
|
||||
"integrity": "sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg==",
|
||||
"dependencies": {
|
||||
"array.prototype.filter": "^1.0.0",
|
||||
"call-bind": "^1.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/html-encoding-sniffer": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz",
|
||||
@@ -11826,24 +11643,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/htmlparser2": {
|
||||
"version": "8.0.2",
|
||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
|
||||
"integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==",
|
||||
"funding": [
|
||||
"https://github.com/fb55/htmlparser2?sponsor=1",
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fb55"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.3",
|
||||
"domutils": "^3.0.1",
|
||||
"entities": "^4.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/http-deceiver": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz",
|
||||
@@ -13093,11 +12892,6 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/is-subset": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz",
|
||||
"integrity": "sha512-6Ybun0IkarhmEqxXCNw/C0bna6Zb/TkfUX9UbwJtK6ObwAVCxmAP308WWTHviM/zAqXk05cdhYsUsZeGQh99iw=="
|
||||
},
|
||||
"node_modules/is-symbol": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz",
|
||||
@@ -15177,27 +14971,12 @@
|
||||
"integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/lodash.escape": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-4.0.1.tgz",
|
||||
"integrity": "sha512-nXEOnb/jK9g0DYMr1/Xvq6l5xMD7GDG55+GSYIYmS0G4tBk/hURD4JR9WCavs04t33WmJx9kCyp9vJ+mr4BOUw=="
|
||||
},
|
||||
"node_modules/lodash.escaperegexp": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz",
|
||||
"integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/lodash.flattendeep": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz",
|
||||
"integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ=="
|
||||
},
|
||||
"node_modules/lodash.isequal": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="
|
||||
},
|
||||
"node_modules/lodash.ismatch": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz",
|
||||
@@ -15806,11 +15585,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/moo": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz",
|
||||
"integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q=="
|
||||
},
|
||||
"node_modules/mrmime": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz",
|
||||
@@ -15889,32 +15663,6 @@
|
||||
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="
|
||||
},
|
||||
"node_modules/nearley": {
|
||||
"version": "2.20.1",
|
||||
"resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz",
|
||||
"integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==",
|
||||
"dependencies": {
|
||||
"commander": "^2.19.0",
|
||||
"moo": "^0.5.0",
|
||||
"railroad-diagrams": "^1.0.0",
|
||||
"randexp": "0.4.6"
|
||||
},
|
||||
"bin": {
|
||||
"nearley-railroad": "bin/nearley-railroad.js",
|
||||
"nearley-test": "bin/nearley-test.js",
|
||||
"nearley-unparse": "bin/nearley-unparse.js",
|
||||
"nearleyc": "bin/nearleyc.js"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://nearley.js.org/#give-to-nearley"
|
||||
}
|
||||
},
|
||||
"node_modules/nearley/node_modules/commander": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
@@ -19251,29 +18999,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/parse5": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz",
|
||||
"integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==",
|
||||
"dependencies": {
|
||||
"entities": "^4.4.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/inikulin/parse5?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/parse5-htmlparser2-tree-adapter": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz",
|
||||
"integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==",
|
||||
"dependencies": {
|
||||
"domhandler": "^5.0.2",
|
||||
"parse5": "^7.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/inikulin/parse5?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
@@ -19346,11 +19071,6 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/performance-now": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
|
||||
@@ -20574,31 +20294,6 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/raf": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
|
||||
"integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
|
||||
"dependencies": {
|
||||
"performance-now": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/railroad-diagrams": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz",
|
||||
"integrity": "sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A=="
|
||||
},
|
||||
"node_modules/randexp": {
|
||||
"version": "0.4.6",
|
||||
"resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz",
|
||||
"integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==",
|
||||
"dependencies": {
|
||||
"discontinuous-range": "1.0.0",
|
||||
"ret": "~0.1.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
@@ -21882,15 +21577,6 @@
|
||||
"rimraf": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/rst-selector-parser": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz",
|
||||
"integrity": "sha512-nDG1rZeP6oFTLN6yNDV/uiAvs1+FS/KlrEwh7+y7dpuApDBy6bI2HTBcc0/V8lv9OTqfyD34eF7au2pm8aBbhA==",
|
||||
"dependencies": {
|
||||
"lodash.flattendeep": "^4.4.0",
|
||||
"nearley": "^2.7.10"
|
||||
}
|
||||
},
|
||||
"node_modules/rsvp": {
|
||||
"version": "4.8.5",
|
||||
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
"@edx/frontend-component-footer": "13.0.2",
|
||||
"@edx/frontend-component-header": "5.0.2",
|
||||
"@edx/frontend-platform": "7.1.0",
|
||||
"@edx/openedx-atlas": "^0.6.0",
|
||||
"@openedx/paragon": "21.11.3",
|
||||
"@edx/react-unit-test-utils": "2.0.0",
|
||||
"@edx/reactifex": "^2.1.1",
|
||||
@@ -44,8 +45,6 @@
|
||||
"classnames": "^2.2.6",
|
||||
"core-js": "3.6.5",
|
||||
"email-prop-type": "^1.1.7",
|
||||
"enzyme": "^3.10.0",
|
||||
"enzyme-to-json": "^3.6.2",
|
||||
"font-awesome": "4.7.0",
|
||||
"history": "4.10.1",
|
||||
"prop-types": "15.8.1",
|
||||
@@ -70,7 +69,6 @@
|
||||
"@edx/browserslist-config": "^1.1.1",
|
||||
"@openedx/frontend-build": "13.0.28",
|
||||
"@testing-library/react": "12.1.5",
|
||||
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
|
||||
"axios": "0.21.2",
|
||||
"axios-mock-adapter": "^1.17.0",
|
||||
"es-check": "^2.3.0",
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
import { AppProvider } from '@edx/frontend-platform/react';
|
||||
import { Route } from 'react-router-dom';
|
||||
|
||||
import Footer from '@edx/frontend-component-footer';
|
||||
import Header from '@edx/frontend-component-header';
|
||||
|
||||
import store from 'data/store';
|
||||
import GradebookPage from 'containers/GradebookPage';
|
||||
|
||||
import App from './App';
|
||||
import Head from './head/Head';
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
BrowserRouter: () => 'BrowserRouter',
|
||||
Route: () => 'Route',
|
||||
Routes: () => 'Routes',
|
||||
}));
|
||||
jest.mock('@edx/frontend-platform/react', () => ({
|
||||
AppProvider: () => 'AppProvider',
|
||||
@@ -24,6 +22,7 @@ jest.mock('@edx/frontend-component-footer', () => 'Footer');
|
||||
jest.mock('data/store', () => 'testStore');
|
||||
jest.mock('containers/GradebookPage', () => 'GradebookPage');
|
||||
jest.mock('@edx/frontend-component-header', () => 'Header');
|
||||
jest.mock('./head/Head', () => 'Head');
|
||||
|
||||
const logo = 'fakeLogo.png';
|
||||
let el;
|
||||
@@ -31,45 +30,41 @@ let secondChild;
|
||||
|
||||
describe('App router component', () => {
|
||||
test('snapshot', () => {
|
||||
expect(shallow(<App />)).toMatchSnapshot();
|
||||
expect(shallow(<App />).snapshot).toMatchSnapshot();
|
||||
});
|
||||
describe('component', () => {
|
||||
beforeEach(() => {
|
||||
process.env.LOGO_POWERED_BY_OPEN_EDX_URL_SVG = logo;
|
||||
el = shallow(<App />);
|
||||
secondChild = el.childAt(1);
|
||||
secondChild = el.instance.children;
|
||||
});
|
||||
describe('AppProvider', () => {
|
||||
test('AppProvider is the parent component, passed the redux store props', () => {
|
||||
expect(el.type()).toBe(AppProvider);
|
||||
expect(el.props().store).toEqual(store);
|
||||
expect(el.instance.type).toBe('AppProvider');
|
||||
expect(el.instance.props.store).toEqual(store);
|
||||
});
|
||||
});
|
||||
describe('Head', () => {
|
||||
test('first child of AppProvider', () => {
|
||||
expect(el.childAt(0).type()).toBe(Head);
|
||||
expect(el.instance.children[0].type).toBe('Head');
|
||||
});
|
||||
});
|
||||
describe('Router', () => {
|
||||
test('second child of AppProvider', () => {
|
||||
expect(secondChild.type()).toBe('div');
|
||||
expect(secondChild[1].type).toBe('div');
|
||||
});
|
||||
test('Header is above/outside-of the routing', () => {
|
||||
expect(secondChild.childAt(0).type()).toBe(Header);
|
||||
expect(secondChild.childAt(1).type()).toBe('main');
|
||||
expect(secondChild[1].children[0].type).toBe('Header');
|
||||
expect(secondChild[1].children[1].type).toBe('main');
|
||||
});
|
||||
test('Routing - GradebookPage is only route', () => {
|
||||
expect(secondChild.find('main')).toEqual(shallow(
|
||||
<main>
|
||||
<Routes>
|
||||
<Route path="/:courseId" element={<GradebookPage />} />
|
||||
</Routes>
|
||||
</main>,
|
||||
));
|
||||
expect(secondChild[1].findByType(Route)).toHaveLength(1);
|
||||
expect(secondChild[1].findByType(Route)[0].props.path).toEqual('/:courseId');
|
||||
expect(secondChild[1].findByType(Route)[0].props.element.type).toEqual(GradebookPage);
|
||||
});
|
||||
});
|
||||
test('Footer logo drawn from env variable', () => {
|
||||
expect(secondChild.find(Footer).props().logo).toEqual(logo);
|
||||
expect(secondChild[1].findByType(Footer)[0].props.logo).toEqual(logo);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,12 +8,12 @@ exports[`App router component snapshot 1`] = `
|
||||
<div>
|
||||
<Header />
|
||||
<main>
|
||||
<Component>
|
||||
<Routes>
|
||||
<Route
|
||||
element={<GradebookPage />}
|
||||
path="/:courseId"
|
||||
/>
|
||||
</Component>
|
||||
</Routes>
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { Alert } from '@openedx/paragon';
|
||||
import { FormattedMessage } from '@edx/frontend-platform/i18n';
|
||||
|
||||
@@ -35,17 +35,17 @@ describe('BulkManagementAlerts', () => {
|
||||
el = shallow(<BulkManagementAlerts />);
|
||||
});
|
||||
test('snapshot - bulkImportError closed, success closed', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('closed danger alert', () => {
|
||||
expect(el.childAt(0).is(Alert)).toEqual(true);
|
||||
expect(el.childAt(0).props().show).toEqual(false);
|
||||
expect(el.childAt(0).props().variant).toEqual('danger');
|
||||
expect(el.instance.children[0].type).toBe('Alert');
|
||||
expect(el.instance.findByType(Alert)[0].props.show).toEqual(false);
|
||||
expect(el.instance.findByType(Alert)[0].props.variant).toEqual('danger');
|
||||
});
|
||||
test('closed success alert', () => {
|
||||
expect(el.childAt(1).is(Alert)).toEqual(true);
|
||||
expect(el.childAt(1).props().show).toEqual(false);
|
||||
expect(el.childAt(1).props().variant).toEqual('success');
|
||||
expect(el.instance.children[1].type).toBe('Alert');
|
||||
expect(el.instance.findByType(Alert)[1].props.show).toEqual(false);
|
||||
expect(el.instance.findByType(Alert)[1].props.variant).toEqual('success');
|
||||
});
|
||||
});
|
||||
describe('no errer, no upload success', () => {
|
||||
@@ -57,19 +57,19 @@ describe('BulkManagementAlerts', () => {
|
||||
'success alert open with messages.successDialog',
|
||||
];
|
||||
test(`snapshot - ${assertions.join(', ')}`, () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('open danger alert with bulkImportError content', () => {
|
||||
expect(el.childAt(0).is(Alert)).toEqual(true);
|
||||
expect(el.childAt(0).children().text()).toEqual(errorMessage);
|
||||
expect(el.childAt(0).props().show).toEqual(true);
|
||||
expect(el.instance.children[0].type).toBe('Alert');
|
||||
expect(el.instance.findByType(Alert)[0].children[0].el).toEqual(errorMessage);
|
||||
expect(el.instance.findByType(Alert)[0].props.show).toEqual(true);
|
||||
});
|
||||
test('open success alert with messages.successDialog content', () => {
|
||||
expect(el.childAt(1).is(Alert)).toEqual(true);
|
||||
expect(el.childAt(1).children().getElement()).toEqual(
|
||||
expect(el.instance.children[1].type).toBe('Alert');
|
||||
expect(el.shallowWrapper.props.children[1].props.children).toEqual(
|
||||
<FormattedMessage {...messages.successDialog} />,
|
||||
);
|
||||
expect(el.childAt(1).props().show).toEqual(true);
|
||||
expect(el.instance.children[1].props.show).toEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable import/no-named-as-default */
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { DataTable } from '@openedx/paragon';
|
||||
|
||||
import selectors from 'data/selectors';
|
||||
@@ -56,12 +56,12 @@ describe('HistoryTable', () => {
|
||||
el = shallow(<HistoryTable {...props} />);
|
||||
});
|
||||
test('snapshot - loads formatted table', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
describe('history table', () => {
|
||||
let table;
|
||||
beforeEach(() => {
|
||||
table = el.find(DataTable);
|
||||
table = el.instance.findByType(DataTable);
|
||||
});
|
||||
describe('data (from bulkManagementHistory.map(this.formatHistoryRow)', () => {
|
||||
const fieldAssertions = [
|
||||
@@ -70,10 +70,10 @@ describe('HistoryTable', () => {
|
||||
'forwards the rest',
|
||||
];
|
||||
test(`snapshot: ${fieldAssertions.join(', ')}`, () => {
|
||||
expect(table.props().data).toMatchSnapshot();
|
||||
expect(table[0].props.data).toMatchSnapshot();
|
||||
});
|
||||
test(fieldAssertions.join(', '), () => {
|
||||
const rows = table.props().data;
|
||||
const rows = table[0].props.data;
|
||||
expect(rows[0].resultsSummary).toEqual(<ResultsSummary {...entry1.resultsSummary} />);
|
||||
expect(rows[0].user).toEqual(<span className="wrap-text-in-cell">{entry1.user}</span>);
|
||||
expect(
|
||||
@@ -87,7 +87,7 @@ describe('HistoryTable', () => {
|
||||
});
|
||||
});
|
||||
test('columns from bulkManagementColumns', () => {
|
||||
expect(table.props().columns).toEqual(bulkManagementColumns);
|
||||
expect(table[0].props.columns).toEqual(bulkManagementColumns);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { Icon } from '@openedx/paragon';
|
||||
import { Download } from '@openedx/paragon/icons';
|
||||
|
||||
import lms from 'data/services/lms';
|
||||
@@ -35,19 +34,19 @@ describe('ResultsSummary component', () => {
|
||||
el = shallow(<ResultsSummary {...props} />);
|
||||
});
|
||||
test(`snapshot - ${assertions.join(', ')}`, () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('Hyperlink has target="_blank" and rel="noopener noreferrer"', () => {
|
||||
expect(el.props().target).toEqual('_blank');
|
||||
expect(el.props().rel).toEqual('noopener noreferrer');
|
||||
expect(el.instance.props.target).toEqual('_blank');
|
||||
expect(el.instance.props.rel).toEqual('noopener noreferrer');
|
||||
});
|
||||
test('Hyperlink has href to bulkGradesUrl', () => {
|
||||
expect(el.props().href).toEqual(lms.urls.bulkGradesUrlByRow(props.rowId));
|
||||
expect(el.instance.props.href).toEqual(lms.urls.bulkGradesUrlByRow(props.rowId));
|
||||
});
|
||||
test('displays Download Icon and text', () => {
|
||||
const icon = el.childAt(0);
|
||||
expect(icon.is(Icon)).toEqual(true);
|
||||
expect(icon.props().src).toEqual(Download);
|
||||
expect(el.childAt(1).text()).toEqual(props.text);
|
||||
const icon = el.instance.children[0];
|
||||
expect(icon.type).toEqual('Icon');
|
||||
expect(icon.props.src).toEqual(Download);
|
||||
expect(el.instance.children[1].el).toEqual(props.text);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable import/no-named-as-default */
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { FormattedMessage } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import { BulkManagementHistoryView } from '.';
|
||||
@@ -24,20 +24,23 @@ describe('BulkManagementHistoryView', () => {
|
||||
'<HistoryTable />',
|
||||
];
|
||||
test(`snapshot - loads ${snapshotSegments.join(', ')}`, () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('heading - h4 loaded from messages', () => {
|
||||
const heading = el.find('h4');
|
||||
expect(heading.getElement()).toEqual((
|
||||
const heading = el.instance.findByType('h4')[0];
|
||||
const expectedHeading = shallow(
|
||||
<h4>
|
||||
<FormattedMessage {...messages.heading} />
|
||||
</h4>
|
||||
));
|
||||
</h4>,
|
||||
);
|
||||
|
||||
expect(heading.el.type).toEqual(expectedHeading.type);
|
||||
expect(heading.el.props).toEqual(expectedHeading.props);
|
||||
});
|
||||
test('heading, then alerts, then upload form, then table', () => {
|
||||
expect(el.childAt(0).is('h4')).toEqual(true);
|
||||
expect(el.childAt(2).is(BulkManagementAlerts)).toEqual(true);
|
||||
expect(el.childAt(3).is(HistoryTable)).toEqual(true);
|
||||
expect(el.instance.children[0].type).toEqual('h4');
|
||||
expect(el.instance.children[2].type).toEqual(BulkManagementAlerts);
|
||||
expect(el.instance.children[3].type).toEqual(HistoryTable);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
|
||||
@@ -16,6 +16,6 @@ describe('Header', () => {
|
||||
test('snapshot - has edx link with logo url', () => {
|
||||
const url = 'www.ourLogo.url';
|
||||
getConfig.mockReturnValue({ LOGO_URL: url });
|
||||
expect(shallow(<Header />)).toMatchSnapshot();
|
||||
expect(shallow(<Header />).snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import SelectGroup from '../SelectGroup';
|
||||
@@ -38,10 +38,10 @@ describe('AssignmentFilter component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('filter options', () => {
|
||||
const { options } = el.find(SelectGroup).props();
|
||||
const { options } = el.instance.findByType(SelectGroup)[0].props;
|
||||
expect(options.length).toEqual(5);
|
||||
const testOption = assignmentFilterOptions[0];
|
||||
const optionProps = options[1].props;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { Button } from '@openedx/paragon';
|
||||
|
||||
@@ -37,20 +37,20 @@ describe('AssignmentFilter component', () => {
|
||||
describe('render', () => {
|
||||
describe('with selected assignment', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
it('renders a PercentGroup for both Max and Min filters', () => {
|
||||
let props = el.find(PercentGroup).at(0).props();
|
||||
let { props } = el.instance.findByType(PercentGroup)[0];
|
||||
expect(props.value).toEqual(hookData.assignmentGradeMin);
|
||||
expect(props.disabled).toEqual(false);
|
||||
expect(props.onChange).toEqual(hookData.handleSetMin);
|
||||
props = el.find(PercentGroup).at(1).props();
|
||||
props = el.instance.findByType(PercentGroup)[1].props;
|
||||
expect(props.value).toEqual(hookData.assignmentGradeMax);
|
||||
expect(props.disabled).toEqual(false);
|
||||
expect(props.onChange).toEqual(hookData.handleSetMax);
|
||||
});
|
||||
it('renders a submit button', () => {
|
||||
const props = el.find(Button).props();
|
||||
const { props } = el.instance.findByType(Button)[0];
|
||||
expect(props.disabled).toEqual(false);
|
||||
expect(props.onClick).toEqual(hookData.handleSubmit);
|
||||
});
|
||||
@@ -64,12 +64,12 @@ describe('AssignmentFilter component', () => {
|
||||
el = shallow(<AssignmentFilter updateQueryParams={updateQueryParams} />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
it('disables controls', () => {
|
||||
let props = el.find(PercentGroup).at(0).props();
|
||||
let { props } = el.instance.findByType(PercentGroup)[0];
|
||||
expect(props.disabled).toEqual(true);
|
||||
props = el.find(PercentGroup).at(1).props();
|
||||
props = el.instance.findByType(PercentGroup)[1].props;
|
||||
expect(props.disabled).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import SelectGroup from '../SelectGroup';
|
||||
@@ -34,10 +34,10 @@ describe('AssignmentFilterType component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('filter options', () => {
|
||||
const { options } = el.find(SelectGroup).props();
|
||||
const { options } = el.instance.findByType(SelectGroup)[0].props;
|
||||
expect(options.length).toEqual(5);
|
||||
const optionProps = options[1].props;
|
||||
expect(optionProps.value).toEqual(assignmentTypes[0]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { Button } from '@openedx/paragon';
|
||||
|
||||
@@ -42,18 +42,18 @@ describe('CourseFilter component', () => {
|
||||
describe('render', () => {
|
||||
describe('with selected assignment', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
it('renders a PercentGroup for both Max and Min filters', () => {
|
||||
let props = el.find(PercentGroup).at(0).props();
|
||||
let { props } = el.instance.findByType(PercentGroup)[0];
|
||||
expect(props.value).toEqual(hookData.min.value);
|
||||
expect(props.onChange).toEqual(hookData.min.onChange);
|
||||
props = el.find(PercentGroup).at(1).props();
|
||||
props = el.instance.findByType(PercentGroup)[1].props;
|
||||
expect(props.value).toEqual(hookData.max.value);
|
||||
expect(props.onChange).toEqual(hookData.max.onChange);
|
||||
});
|
||||
it('renders a submit button', () => {
|
||||
const props = el.find(Button).props();
|
||||
const { props } = el.instance.findByType(Button)[0];
|
||||
expect(props.disabled).toEqual(false);
|
||||
expect(props.onClick).toEqual(hookData.handleApplyClick);
|
||||
});
|
||||
@@ -64,10 +64,10 @@ describe('CourseFilter component', () => {
|
||||
el = shallow(<CourseFilter updateQueryParams={updateQueryParams} />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
it('disables submit', () => {
|
||||
const props = el.find(Button).props();
|
||||
const { props } = el.instance.findByType(Button)[0];
|
||||
expect(props.disabled).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import PercentGroup from './PercentGroup';
|
||||
|
||||
@@ -22,11 +22,11 @@ describe('PercentGroup', () => {
|
||||
describe('snapshots', () => {
|
||||
test('basic snapshot', () => {
|
||||
const el = shallow(<PercentGroup {...props} />);
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('disabled', () => {
|
||||
const el = shallow(<PercentGroup {...props} disabled />);
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import SelectGroup from './SelectGroup';
|
||||
|
||||
@@ -27,11 +27,11 @@ describe('SelectGroup', () => {
|
||||
describe('snapshots', () => {
|
||||
test('basic snapshot', () => {
|
||||
const el = shallow(<SelectGroup {...props} />);
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('disabled', () => {
|
||||
const el = shallow(<SelectGroup {...props} disabled />);
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import SelectGroup from '../SelectGroup';
|
||||
@@ -48,14 +48,14 @@ describe('StudentGroupsFilter component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('track options', () => {
|
||||
const {
|
||||
options,
|
||||
onChange,
|
||||
value,
|
||||
} = el.find(SelectGroup).at(0).props();
|
||||
} = el.instance.findByType(SelectGroup)[0].props;
|
||||
expect(value).toEqual(props.tracks.value);
|
||||
expect(onChange).toEqual(props.tracks.handleChange);
|
||||
expect(options.length).toEqual(5);
|
||||
@@ -70,7 +70,7 @@ describe('StudentGroupsFilter component', () => {
|
||||
onChange,
|
||||
disabled,
|
||||
value,
|
||||
} = el.find(SelectGroup).at(1).props();
|
||||
} = el.instance.findByType(SelectGroup)[1].props;
|
||||
expect(value).toEqual(props.cohorts.value);
|
||||
expect(disabled).toEqual(false);
|
||||
expect(onChange).toEqual(props.cohorts.handleChange);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { Collapsible } from '@openedx/paragon';
|
||||
@@ -49,10 +49,10 @@ describe('GradebookFilters', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('Assignment filters', () => {
|
||||
expect(el.find(Collapsible).at(0).children()).toMatchObject(shallow(
|
||||
expect(el.instance.findByType(Collapsible)[0].children[0]).toMatchObject(shallow(
|
||||
<div>
|
||||
<AssignmentTypeFilter updateQueryParams={updateQueryParams} />
|
||||
<AssignmentFilter updateQueryParams={updateQueryParams} />
|
||||
@@ -61,22 +61,22 @@ describe('GradebookFilters', () => {
|
||||
));
|
||||
});
|
||||
test('CourseGrade filters', () => {
|
||||
expect(el.find(Collapsible).at(1).children()).toMatchObject(shallow(
|
||||
expect(el.instance.findByType(Collapsible)[1].children[0]).toMatchObject(shallow(
|
||||
<CourseGradeFilter updateQueryParams={updateQueryParams} />,
|
||||
));
|
||||
});
|
||||
test('StudentGroups filters', () => {
|
||||
expect(el.find(Collapsible).at(2).children()).toMatchObject(shallow(
|
||||
expect(el.instance.findByType(Collapsible)[2].children[0]).toMatchObject(shallow(
|
||||
<StudentGroupsFilter updateQueryParams={updateQueryParams} />,
|
||||
));
|
||||
});
|
||||
test('includeCourseTeamMembers', () => {
|
||||
const checkbox = el.find(Collapsible).at(3).children();
|
||||
expect(checkbox.props()).toEqual({
|
||||
const checkbox = el.instance.findByType(Collapsible)[3].children[0];
|
||||
expect(checkbox.props).toEqual({
|
||||
checked: true,
|
||||
onChange: hookProps.includeCourseTeamMembers.handleChange,
|
||||
children: formatMessage(messages.includeCourseTeamMembers),
|
||||
});
|
||||
expect(checkbox.children[0].el).toEqual(formatMessage(messages.includeCourseTeamMembers));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { Button } from '@openedx/paragon';
|
||||
|
||||
@@ -40,7 +40,7 @@ describe('GradebookHeader component', () => {
|
||||
describe('render', () => {
|
||||
describe('default view', () => {
|
||||
test('shapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
describe('show bulk management', () => {
|
||||
@@ -49,10 +49,10 @@ describe('GradebookHeader component', () => {
|
||||
el = shallow(<GradebookHeader />);
|
||||
});
|
||||
test('snapshot: show toggle view message button with handleToggleViewClick method', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
const { onClick, children } = el.find(Button).props();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
const { onClick } = el.instance.findByType(Button)[0].props;
|
||||
expect(onClick).toEqual(hookProps.handleToggleViewClick);
|
||||
expect(children).toEqual(formatMessage(hookProps.toggleViewMessage));
|
||||
expect(el.instance.findByType(Button)[0].children[0].el).toEqual(formatMessage(hookProps.toggleViewMessage));
|
||||
});
|
||||
});
|
||||
describe('frozen grades', () => {
|
||||
@@ -61,7 +61,7 @@ describe('GradebookHeader component', () => {
|
||||
el = shallow(<GradebookHeader />);
|
||||
});
|
||||
test('snapshot: show frozen warning', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
describe('user cannot view gradebook', () => {
|
||||
@@ -70,7 +70,7 @@ describe('GradebookHeader component', () => {
|
||||
el = shallow(<GradebookHeader />);
|
||||
});
|
||||
test('snapshot: show unauthorized warning', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import useBulkManagementControlsData from './hooks';
|
||||
import BulkManagementControls from '.';
|
||||
@@ -22,7 +22,7 @@ describe('BulkManagementControls', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot - show - network and import buttons', () => {
|
||||
expect(shallow(<BulkManagementControls />)).toMatchSnapshot();
|
||||
expect(shallow(<BulkManagementControls />).snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('snapshot - empty if show is not truthy', () => {
|
||||
useBulkManagementControlsData.mockReturnValueOnce({ ...hookProps, show: false });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import HistoryHeader from './HistoryHeader';
|
||||
|
||||
@@ -11,7 +11,7 @@ describe('HistoryHeader', () => {
|
||||
};
|
||||
describe('Component', () => {
|
||||
test('snapshot', () => {
|
||||
expect(shallow(<HistoryHeader {...props} />)).toMatchSnapshot();
|
||||
expect(shallow(<HistoryHeader {...props} />).snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { selectors } from 'data/redux/hooks';
|
||||
@@ -47,10 +47,10 @@ describe('ModalHeaders', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('assignment header', () => {
|
||||
const headerProps = el.find(HistoryHeader).at(0).props();
|
||||
const headerProps = el.instance.findByType(HistoryHeader)[0].props;
|
||||
expect(headerProps).toMatchObject({
|
||||
id: HistoryKeys.assignment,
|
||||
label: formatMessage(messages.assignmentHeader),
|
||||
@@ -58,7 +58,7 @@ describe('ModalHeaders', () => {
|
||||
});
|
||||
});
|
||||
test('student header', () => {
|
||||
const headerProps = el.find(HistoryHeader).at(1).props();
|
||||
const headerProps = el.instance.findByType(HistoryHeader)[1].props;
|
||||
expect(headerProps).toMatchObject({
|
||||
id: HistoryKeys.student,
|
||||
label: formatMessage(messages.studentHeader),
|
||||
@@ -66,7 +66,7 @@ describe('ModalHeaders', () => {
|
||||
});
|
||||
});
|
||||
test('originalGrade header', () => {
|
||||
const headerProps = el.find(HistoryHeader).at(2).props();
|
||||
const headerProps = el.instance.findByType(HistoryHeader)[2].props;
|
||||
expect(headerProps).toMatchObject({
|
||||
id: HistoryKeys.originalGrade,
|
||||
label: formatMessage(messages.originalGradeHeader),
|
||||
@@ -74,7 +74,7 @@ describe('ModalHeaders', () => {
|
||||
});
|
||||
});
|
||||
test('currentGrade header', () => {
|
||||
const headerProps = el.find(HistoryHeader).at(3).props();
|
||||
const headerProps = el.instance.findByType(HistoryHeader)[3].props;
|
||||
expect(headerProps).toMatchObject({
|
||||
id: HistoryKeys.currentGrade,
|
||||
label: formatMessage(messages.currentGradeHeader),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { Form } from '@openedx/paragon';
|
||||
|
||||
@@ -28,11 +28,11 @@ describe('AdjustedGradeInput component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
const control = el.find(Form.Control);
|
||||
expect(control.props().value).toEqual(hookProps.value);
|
||||
expect(control.props().onChange).toEqual(hookProps.onChange);
|
||||
expect(el.contains(hookProps.hintText)).toEqual(true);
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
const control = el.instance.findByType(Form.Control)[0];
|
||||
expect(control.props.value).toEqual(hookProps.value);
|
||||
expect(control.props.onChange).toEqual(hookProps.onChange);
|
||||
expect(el.instance.children[1].el).toContain(hookProps.hintText);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { Form } from '@openedx/paragon';
|
||||
|
||||
@@ -28,10 +28,10 @@ describe('ReasonInput component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
const control = el.find(Form.Control);
|
||||
expect(control.props().value).toEqual(hookProps.value);
|
||||
expect(control.props().onChange).toEqual(hookProps.onChange);
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
const control = el.instance.findByType(Form.Control)[0];
|
||||
expect(control.props.value).toEqual(hookProps.value);
|
||||
expect(control.props.onChange).toEqual(hookProps.onChange);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { DataTable } from '@openedx/paragon';
|
||||
|
||||
@@ -48,10 +48,10 @@ describe('OverrideTable component', () => {
|
||||
expect(el.isEmptyRender()).toEqual(true);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
const table = el.find(DataTable);
|
||||
expect(table.props().columns).toEqual(hookProps.columns);
|
||||
const data = [...table.props().data];
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
const table = el.instance.findByType(DataTable)[0];
|
||||
expect(table.props.columns).toEqual(hookProps.columns);
|
||||
const data = [...table.props.data];
|
||||
const inputRow = data.pop();
|
||||
const formattedDate = formatDateForDisplay(new Date());
|
||||
expect(data).toEqual(hookProps.data);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import {
|
||||
ActionRow,
|
||||
@@ -43,60 +43,56 @@ describe('EditModal component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('modal props', () => {
|
||||
const modalProps = el.find(ModalDialog).props();
|
||||
const modalProps = el.instance.findByType(ModalDialog)[0].props;
|
||||
expect(modalProps.title).toEqual(formatMessage(messages.title));
|
||||
expect(modalProps.isOpen).toEqual(hookProps.isOpen);
|
||||
expect(modalProps.onClose).toEqual(hookProps.onClose);
|
||||
});
|
||||
const loadBody = () => {
|
||||
const body = el.find(ModalDialog).children().at(0);
|
||||
const children = body.find('div').children();
|
||||
const body = el.instance.findByType(ModalDialog)[0].children[0];
|
||||
const { children } = body.children[0];
|
||||
return { body, children };
|
||||
};
|
||||
const testBody = () => {
|
||||
test('type', () => {
|
||||
const { body } = loadBody();
|
||||
expect(body.type()).toEqual('ModalDialog.Body');
|
||||
expect(body.type).toEqual('ModalDialog.Body');
|
||||
});
|
||||
test('headers row', () => {
|
||||
const { children } = loadBody();
|
||||
expect(children.at(0)).toMatchObject(shallow(<ModalHeaders />));
|
||||
expect(children[0]).toMatchObject(shallow(<ModalHeaders />));
|
||||
});
|
||||
test('table row', () => {
|
||||
const { children } = loadBody();
|
||||
expect(children.at(2)).toMatchObject(shallow(<OverrideTable />));
|
||||
expect(children[2]).toMatchObject(shallow(<OverrideTable />));
|
||||
});
|
||||
test('messages', () => {
|
||||
const { children } = loadBody();
|
||||
expect(
|
||||
children.at(3).contains(formatMessage(messages.visibility)),
|
||||
).toEqual(true);
|
||||
expect(
|
||||
children.at(4).contains(formatMessage(messages.saveVisibility)),
|
||||
).toEqual(true);
|
||||
expect(children[3].children[0].el).toEqual(formatMessage(messages.visibility));
|
||||
expect(children[4].children[0].el).toEqual(formatMessage(messages.saveVisibility));
|
||||
});
|
||||
};
|
||||
const testFooter = () => {
|
||||
let footer;
|
||||
beforeEach(() => {
|
||||
footer = el.find(ModalDialog).children().at(1);
|
||||
footer = el.instance.findByType(ModalDialog)[0].children;
|
||||
});
|
||||
test('type', () => {
|
||||
expect(footer.type()).toEqual('ModalDialog.Footer');
|
||||
expect(footer[1].type).toEqual('ModalDialog.Footer');
|
||||
});
|
||||
test('contains action row', () => {
|
||||
expect(footer.children().at(0).type()).toEqual('ActionRow');
|
||||
expect(footer[1].children[0].type).toEqual('ActionRow');
|
||||
});
|
||||
test('close button', () => {
|
||||
const button = footer.find(ActionRow).children().at(0);
|
||||
expect(button.contains(formatMessage(messages.closeText))).toEqual(true);
|
||||
expect(button.type()).toEqual('ModalDialog.CloseButton');
|
||||
const button = footer[1].findByType(ActionRow)[0].children[0];
|
||||
expect(button.children[0].el).toEqual(formatMessage(messages.closeText));
|
||||
expect(button.type).toEqual('ModalDialog.CloseButton');
|
||||
});
|
||||
test('adjusted grade button', () => {
|
||||
const button = footer.find(ActionRow).children().at(1);
|
||||
expect(button.contains(formatMessage(messages.saveGrade))).toEqual(true);
|
||||
expect(button.type()).toEqual('Button');
|
||||
expect(button.props().onClick).toEqual(hookProps.handleAdjustedGradeClick);
|
||||
const button = footer[1].findByType(ActionRow)[0].children[1];
|
||||
expect(button.children[0].el).toEqual(formatMessage(messages.saveGrade));
|
||||
expect(button.type).toEqual('Button');
|
||||
expect(button.props.onClick).toEqual(hookProps.handleAdjustedGradeClick);
|
||||
});
|
||||
};
|
||||
describe('without error', () => {
|
||||
@@ -105,26 +101,26 @@ describe('EditModal component', () => {
|
||||
el = shallow(<EditModal />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
testBody();
|
||||
testFooter();
|
||||
test('alert row', () => {
|
||||
const alert = loadBody().children.at(1);
|
||||
expect(alert.type()).toEqual('Alert');
|
||||
expect(alert.props().show).toEqual(false);
|
||||
const alert = loadBody().children[1];
|
||||
expect(alert.type).toEqual('Alert');
|
||||
expect(alert.props.show).toEqual(false);
|
||||
});
|
||||
});
|
||||
describe('with error', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
testBody();
|
||||
test('alert row', () => {
|
||||
const alert = loadBody().children.at(1);
|
||||
expect(alert.type()).toEqual('Alert');
|
||||
expect(alert.props().show).toEqual(true);
|
||||
expect(alert.contains(hookProps.error)).toEqual(true);
|
||||
const alert = loadBody().children[1];
|
||||
expect(alert.type).toEqual('Alert');
|
||||
expect(alert.props.show).toEqual(true);
|
||||
expect(alert.children[0].el).toEqual(hookProps.error);
|
||||
});
|
||||
testFooter();
|
||||
});
|
||||
|
||||
@@ -32,8 +32,8 @@ export const FilterBadge = ({
|
||||
return (
|
||||
<div>
|
||||
<span className="badge badge-info">
|
||||
<span>{formatMessage(displayName)}</span>
|
||||
<span>
|
||||
<span data-testid="display-name">{formatMessage(displayName)}</span>
|
||||
<span data-testid="filter-value">
|
||||
{!hideValue ? `: ${value}` : ''}
|
||||
</span>
|
||||
<Button
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import { formatMessage } from 'testUtils';
|
||||
@@ -48,12 +48,12 @@ describe('FilterBadge', () => {
|
||||
describe('render', () => {
|
||||
const testDisplayName = () => {
|
||||
test('formatted display name appears on badge', () => {
|
||||
expect(el.contains(formatMessage(hookProps.displayName))).toEqual(true);
|
||||
expect(el.instance.findByTestId('display-name')[0].children[0].el).toEqual(formatMessage(hookProps.displayName));
|
||||
});
|
||||
};
|
||||
const testCloseButton = () => {
|
||||
test('close button forwards close method', () => {
|
||||
expect(el.find(Button).props().onClick).toEqual(handleClose(hookProps.connectedFilters));
|
||||
expect(el.instance.findByType(Button)[0].props.onClick).toEqual(handleClose(hookProps.connectedFilters));
|
||||
});
|
||||
};
|
||||
test('empty render if isDefault', () => {
|
||||
@@ -75,20 +75,20 @@ describe('FilterBadge', () => {
|
||||
testDisplayName();
|
||||
testCloseButton();
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('value is note present in the badge', () => {
|
||||
expect(el.contains(hookProps.value)).toEqual(false);
|
||||
expect(el.instance.findByTestId('filter-value')[0].children).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
describe('do not hide value', () => {
|
||||
testDisplayName();
|
||||
testCloseButton();
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('value is note present in the badge', () => {
|
||||
expect(el.text().includes(hookProps.value)).toEqual(true);
|
||||
test('value is present in the badge', () => {
|
||||
expect(el.instance.findByTestId('filter-value')[0].children[0].el).toBe(`: ${hookProps.value}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,10 +5,14 @@ exports[`FilterBadge render do not hide value snapshot 1`] = `
|
||||
<span
|
||||
className="badge badge-info"
|
||||
>
|
||||
<span>
|
||||
<span
|
||||
data-testid="display-name"
|
||||
>
|
||||
a common name
|
||||
</span>
|
||||
<span>
|
||||
<span
|
||||
data-testid="filter-value"
|
||||
>
|
||||
: a common value
|
||||
</span>
|
||||
<Button
|
||||
@@ -39,10 +43,14 @@ exports[`FilterBadge render hide Value snapshot 1`] = `
|
||||
<span
|
||||
className="badge badge-info"
|
||||
>
|
||||
<span>
|
||||
<span
|
||||
data-testid="display-name"
|
||||
>
|
||||
a common name
|
||||
</span>
|
||||
<span />
|
||||
<span
|
||||
data-testid="filter-value"
|
||||
/>
|
||||
<Button
|
||||
aria-label="close"
|
||||
className="btn-info"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable import/no-named-as-default */
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import FilterBadges from '.';
|
||||
import FilterBadge from './FilterBadge';
|
||||
@@ -22,14 +22,14 @@ describe('FilterBadges', () => {
|
||||
el = shallow(<FilterBadges handleClose={handleClose} />);
|
||||
});
|
||||
test('snapshot - has a filterbadge with handleClose for each filter in badgeOrder', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('has a filterbadge with handleClose for each filter in badgeOrder', () => {
|
||||
const badgeProps = el.find(FilterBadge).map(badgeEl => badgeEl.props());
|
||||
const badgeProps = el.instance.findByType(FilterBadge).map(badgeEl => badgeEl.props);
|
||||
// key prop is not rendered by react
|
||||
expect(badgeProps[0]).toEqual({ filterName: order[0], handleClose });
|
||||
expect(badgeProps[1]).toEqual({ filterName: order[1], handleClose });
|
||||
expect(badgeProps[2]).toEqual({ filterName: order[2], handleClose });
|
||||
expect(badgeProps[0]).toMatchObject({ filterName: order[0], handleClose });
|
||||
expect(badgeProps[1]).toMatchObject({ filterName: order[1], handleClose });
|
||||
expect(badgeProps[2]).toMatchObject({ filterName: order[2], handleClose });
|
||||
expect(badgeProps.length).toEqual(3);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
|
||||
@@ -38,10 +38,10 @@ describe('FilterMenuToggle component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.type()).toEqual('Button');
|
||||
expect(el.props().onClick).toEqual(toggleFilterMenu);
|
||||
expect(el.text().includes(formatMessage(messages.editFilters)));
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
expect(el.instance.type).toEqual('Button');
|
||||
expect(el.instance.props.onClick).toEqual(toggleFilterMenu);
|
||||
expect(el.instance.children[2].el).toContain(formatMessage(messages.editFilters));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
|
||||
@@ -46,8 +46,8 @@ describe('FilteredUsersLabel component', () => {
|
||||
expect(shallow(<FilteredUsersLabel />).isEmptyRender()).toEqual(true);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el).toMatchObject(shallow(formatMessage(messages.visibilityLabel, {
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
expect(el.instance).toMatchObject(shallow(formatMessage(messages.visibilityLabel, {
|
||||
filteredUsers: <BoldText text={userCounts.filteredUsersCount} />,
|
||||
totalUsers: <BoldText text={userCounts.totalUsersCount} />,
|
||||
})));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import Fields from './Fields';
|
||||
|
||||
@@ -16,14 +16,13 @@ describe('Gradebook Table Fields', () => {
|
||||
el = shallow(<Fields.Username {...props} />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('wraps external user key and username', () => {
|
||||
expect(el.find('span').childAt(0)).toMatchSnapshot();
|
||||
expect(el.find('span').childAt(0)).toMatchSnapshot();
|
||||
const content = el.find('span').childAt(0);
|
||||
expect(content.childAt(0).text()).toEqual(username);
|
||||
expect(content.childAt(1).text()).toEqual(props.userKey);
|
||||
expect(el.instance.findByType('span')[0].el).toMatchSnapshot();
|
||||
const content = el.instance.findByType('span')[0].children[0];
|
||||
expect(content.children[0].children[0].el).toEqual(username);
|
||||
expect(content.children[1].children[0].el).toEqual(props.userKey);
|
||||
});
|
||||
});
|
||||
describe('without external_user_key', () => {
|
||||
@@ -31,12 +30,12 @@ describe('Gradebook Table Fields', () => {
|
||||
el = shallow(<Fields.Username username={username} />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('wraps username only', () => {
|
||||
const content = el.find('span').childAt(0);
|
||||
expect(content.childAt(0).text()).toEqual(username);
|
||||
expect(content.children()).toHaveLength(1);
|
||||
const content = el.instance.findByType('span')[0].children[0];
|
||||
expect(content.children[0].children[0].el).toEqual(username);
|
||||
expect(content.children).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -44,10 +43,10 @@ describe('Gradebook Table Fields', () => {
|
||||
describe('Text', () => {
|
||||
const value = 'myTag@place.com';
|
||||
test('snapshot', () => {
|
||||
expect(shallow(<Fields.Text value={value} />)).toMatchSnapshot();
|
||||
expect(shallow(<Fields.Text value={value} />).snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('wraps entry value', () => {
|
||||
expect(shallow(<Fields.Text value={value} />).text()).toEqual(value);
|
||||
expect(shallow(<Fields.Text value={value} />).instance.children[0].el).toEqual(value);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { selectors, thunkActions } from 'data/redux/hooks';
|
||||
import transforms from 'data/redux/transforms';
|
||||
@@ -101,8 +101,8 @@ describe('GradeButton', () => {
|
||||
el = shallow(<GradeButton {...props} />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.text()).toEqual(hookProps.label);
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
expect(el.instance.el).toEqual(hookProps.label);
|
||||
});
|
||||
});
|
||||
describe('not frozen grades', () => {
|
||||
@@ -111,10 +111,10 @@ describe('GradeButton', () => {
|
||||
el = shallow(<GradeButton {...props} />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.type()).toEqual('Button');
|
||||
expect(el.props().onClick).toEqual(hookProps.onClick);
|
||||
expect(el.contains(hookProps.label)).toEqual(true);
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
expect(el.instance.type).toEqual('Button');
|
||||
expect(el.instance.props.onClick).toEqual(hookProps.onClick);
|
||||
expect(el.instance.children[0].el).toEqual(hookProps.label);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { getLocale } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import { OverlayTrigger } from '@openedx/paragon';
|
||||
@@ -25,15 +25,15 @@ describe('LabelReplacements', () => {
|
||||
el = shallow(<TotalGradeLabelReplacement />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('displays overlay tooltip', () => {
|
||||
expect(el.find(OverlayTrigger).props().overlay).toMatchSnapshot();
|
||||
expect(el.instance.findByType(OverlayTrigger)[0].props.overlay).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
describe('UsernameLabelReplacement', () => {
|
||||
test('snapshot', () => {
|
||||
expect(shallow(<UsernameLabelReplacement />)).toMatchSnapshot();
|
||||
expect(shallow(<UsernameLabelReplacement />).snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
describe('MastersOnlyLabelReplacement', () => {
|
||||
@@ -43,7 +43,7 @@ describe('LabelReplacements', () => {
|
||||
defaultMessage: 'defaultMessAge',
|
||||
description: 'desCripTion',
|
||||
};
|
||||
expect(shallow(<MastersOnlyLabelReplacement {...message} />)).toMatchSnapshot();
|
||||
expect(shallow(<MastersOnlyLabelReplacement {...message} />).snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -53,11 +53,11 @@ describe('snapshot', () => {
|
||||
test('right to left overlay placement', () => {
|
||||
getLocale.mockImplementation(() => 'en');
|
||||
el = shallow(<TotalGradeLabelReplacement />);
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('left to right overlay placement', () => {
|
||||
getLocale.mockImplementation(() => 'ar');
|
||||
el = shallow(<TotalGradeLabelReplacement />);
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -28,29 +28,36 @@ exports[`Gradebook Table Fields Username with external_user_key snapshot 1`] = `
|
||||
`;
|
||||
|
||||
exports[`Gradebook Table Fields Username with external_user_key wraps external user key and username 1`] = `
|
||||
<div>
|
||||
<div>
|
||||
MyNameFromHere
|
||||
</div>
|
||||
<div
|
||||
className="student-key"
|
||||
>
|
||||
My name from another land
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Gradebook Table Fields Username with external_user_key wraps external user key and username 2`] = `
|
||||
<div>
|
||||
<div>
|
||||
MyNameFromHere
|
||||
</div>
|
||||
<div
|
||||
className="student-key"
|
||||
>
|
||||
My name from another land
|
||||
</div>
|
||||
</div>
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"children": Array [
|
||||
Object {
|
||||
"children": Array [
|
||||
"MyNameFromHere",
|
||||
],
|
||||
"props": Object {},
|
||||
"type": "div",
|
||||
},
|
||||
Object {
|
||||
"children": Array [
|
||||
"My name from another land",
|
||||
],
|
||||
"props": Object {
|
||||
"className": "student-key",
|
||||
},
|
||||
"type": "div",
|
||||
},
|
||||
],
|
||||
"props": Object {},
|
||||
"type": "div",
|
||||
},
|
||||
],
|
||||
"props": Object {
|
||||
"className": "wrap-text-in-cell",
|
||||
},
|
||||
"type": "span",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Gradebook Table Fields Username without external_user_key snapshot 1`] = `
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { DataTable } from '@openedx/paragon';
|
||||
|
||||
@@ -24,16 +24,16 @@ describe('GradebookTable', () => {
|
||||
el = shallow(<GradebookTable />);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('Datatable props', () => {
|
||||
const datatable = el.find(DataTable);
|
||||
const props = datatable.props();
|
||||
const datatable = el.instance.findByType(DataTable)[0];
|
||||
const { props } = datatable;
|
||||
expect(props.columns).toEqual(hookProps.columns);
|
||||
expect(props.data).toEqual(hookProps.data);
|
||||
expect(props.itemCount).toEqual(hookProps.grades.length);
|
||||
expect(props.RowStatusComponent).toEqual(hookProps.nullMethod);
|
||||
expect(datatable.children().at(2).type()).toEqual('DataTable.EmptyTable');
|
||||
expect(datatable.children().at(2).props().content).toEqual(hookProps.emptyContent);
|
||||
expect(datatable.children[2].type).toEqual('DataTable.EmptyTable');
|
||||
expect(datatable.children[2].props.content).toEqual(hookProps.emptyContent);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import useImportSuccessToastData from './hooks';
|
||||
import ImportSuccessToast from '.';
|
||||
@@ -26,14 +26,14 @@ describe('ImportSuccessToast component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('Toast', () => {
|
||||
expect(el.type()).toEqual('Toast');
|
||||
expect(el.props().action).toEqual(hookProps.action);
|
||||
expect(el.props().onClose).toEqual(hookProps.onClose);
|
||||
expect(el.props().show).toEqual(hookProps.show);
|
||||
expect(el.text()).toEqual(hookProps.description);
|
||||
expect(el.instance.type).toEqual('Toast');
|
||||
expect(el.instance.props.action).toEqual(hookProps.action);
|
||||
expect(el.instance.props.onClose).toEqual(hookProps.onClose);
|
||||
expect(el.instance.props.show).toEqual(hookProps.show);
|
||||
expect(el.instance.children[0].el).toEqual(hookProps.description);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
|
||||
@@ -33,8 +33,8 @@ describe('InterventionsReport component', () => {
|
||||
expect(el.isEmptyRender()).toEqual(true);
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
const btnProps = el.find(NetworkButton).props();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
const btnProps = el.instance.findByType(NetworkButton)[0].props;
|
||||
expect(btnProps.label).toEqual(messages.downloadBtn);
|
||||
expect(btnProps.onClick).toEqual(hookProps.handleClick);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { Button } from '@openedx/paragon';
|
||||
|
||||
@@ -35,19 +35,19 @@ describe('PageButtons component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('prev button', () => {
|
||||
const button = el.find(Button).at(0);
|
||||
expect(button.props().disabled).toEqual(hookProps.prev.disabled);
|
||||
expect(button.props().onClick).toEqual(hookProps.prev.onClick);
|
||||
expect(button.text()).toEqual(hookProps.prev.text);
|
||||
const button = el.instance.findByType(Button)[0];
|
||||
expect(button.props.disabled).toEqual(hookProps.prev.disabled);
|
||||
expect(button.props.onClick).toEqual(hookProps.prev.onClick);
|
||||
expect(button.children[0].el).toEqual(hookProps.prev.text);
|
||||
});
|
||||
test('next button', () => {
|
||||
const button = el.find(Button).at(1);
|
||||
expect(button.props().disabled).toEqual(hookProps.next.disabled);
|
||||
expect(button.props().onClick).toEqual(hookProps.next.onClick);
|
||||
expect(button.text()).toEqual(hookProps.next.text);
|
||||
const button = el.instance.findByType(Button)[1];
|
||||
expect(button.props.disabled).toEqual(hookProps.next.disabled);
|
||||
expect(button.props.onClick).toEqual(hookProps.next.onClick);
|
||||
expect(button.children[0].el).toEqual(hookProps.next.text);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { GradeFormats } from 'data/constants/grades';
|
||||
@@ -40,27 +40,27 @@ describe('ScoreViewInput component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('label', () => {
|
||||
const label = el.children().at(0);
|
||||
expect(label.text()).toEqual(`${formatMessage(messages.scoreView)}:`);
|
||||
const label = el.instance.children[0];
|
||||
expect(label.children[0].el).toEqual(`${formatMessage(messages.scoreView)}`);
|
||||
});
|
||||
describe('form control', () => {
|
||||
let control;
|
||||
beforeEach(() => {
|
||||
control = el.children().at(1);
|
||||
control = el.instance.children;
|
||||
});
|
||||
test('value and onChange from redux hooks', () => {
|
||||
expect(control.props().value).toEqual(gradeFormat);
|
||||
expect(control.props().onChange).toEqual(toggleGradeFormat);
|
||||
expect(control[1].props.value).toEqual(gradeFormat);
|
||||
expect(control[1].props.onChange).toEqual(toggleGradeFormat);
|
||||
});
|
||||
test('absolute and percent options', () => {
|
||||
const children = control.children();
|
||||
expect(children.at(0).props().value).toEqual(GradeFormats.percent);
|
||||
expect(children.at(0).text()).toEqual(formatMessage(messages.percent));
|
||||
expect(children.at(1).props().value).toEqual(GradeFormats.absolute);
|
||||
expect(children.at(1).text()).toEqual(formatMessage(messages.absolute));
|
||||
const { children } = control[1];
|
||||
expect(children[0].props.value).toEqual(GradeFormats.percent);
|
||||
expect(children[0].children[0].el).toEqual(formatMessage(messages.percent));
|
||||
expect(children[1].props.value).toEqual(GradeFormats.absolute);
|
||||
expect(children[1].children[0].el).toEqual(formatMessage(messages.absolute));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { SearchField } from '@openedx/paragon';
|
||||
|
||||
@@ -31,10 +31,10 @@ describe('SearchControls component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('search field', () => {
|
||||
const props = el.find(SearchField).props();
|
||||
const { props } = el.instance.findByType(SearchField)[0];
|
||||
expect(props.onSubmit).toEqual(hookProps.onSubmit);
|
||||
expect(props.onBlur).toEqual(hookProps.onBlur);
|
||||
expect(props.onClear).toEqual(hookProps.onClear);
|
||||
@@ -42,7 +42,7 @@ describe('SearchControls component', () => {
|
||||
expect(props.value).toEqual(hookProps.searchValue);
|
||||
});
|
||||
test('hint text', () => {
|
||||
expect(el.find('small').text()).toEqual(hookProps.hintText);
|
||||
expect(el.instance.findByType('small')[0].children[0].el).toEqual(hookProps.hintText);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { selectors } from 'data/redux/hooks';
|
||||
import SpinnerIcon from './SpinnerIcon';
|
||||
@@ -29,7 +29,7 @@ describe('SpinnerIcon', () => {
|
||||
expect(el.isEmptyRender()).toEqual(true);
|
||||
});
|
||||
test('snapshot - displays spinner overlay with spinner icon', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { Alert } from '@openedx/paragon';
|
||||
|
||||
@@ -34,20 +34,20 @@ describe('StatusAlerts component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('success banner', () => {
|
||||
const alert = el.find(Alert).at(0);
|
||||
const props = alert.props();
|
||||
const alert = el.instance.findByType(Alert)[0];
|
||||
const { props } = alert;
|
||||
expect(props.onClose).toEqual(hookProps.successBanner.onClose);
|
||||
expect(props.show).toEqual(hookProps.successBanner.show);
|
||||
expect(alert.text()).toEqual(hookProps.successBanner.text);
|
||||
expect(alert.children[0].el).toEqual(hookProps.successBanner.text);
|
||||
});
|
||||
test('grade filter banner', () => {
|
||||
const alert = el.find(Alert).at(1);
|
||||
const props = alert.props();
|
||||
const alert = el.instance.findByType(Alert)[1];
|
||||
const { props } = alert;
|
||||
expect(props.show).toEqual(hookProps.gradeFilter.show);
|
||||
expect(alert.text()).toEqual(hookProps.gradeFilter.text);
|
||||
expect(alert.children[0].el).toEqual(hookProps.gradeFilter.text);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import FilterBadges from './FilterBadges';
|
||||
|
||||
@@ -46,10 +46,10 @@ describe('GradesView component', () => {
|
||||
});
|
||||
describe('render', () => {
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('filterBadges load close behavior from hook', () => {
|
||||
expect(el.find(FilterBadges).props().handleClose).toEqual(
|
||||
expect(el.instance.findByType(FilterBadges)[0].props.handleClose).toEqual(
|
||||
hookProps.handleFilterBadgeClose,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import { Icon, StatefulButton } from '@openedx/paragon';
|
||||
import { FormattedMessage } from '@edx/frontend-platform/i18n';
|
||||
@@ -37,10 +37,10 @@ describe('NetworkButton component', () => {
|
||||
beforeEach(() => {
|
||||
props.onClick = jest.fn();
|
||||
el = shallow(<NetworkButton {...props} />);
|
||||
btnProps = el.find(StatefulButton).props();
|
||||
btnProps = el.instance.findByType(StatefulButton)[0].props;
|
||||
});
|
||||
test('snapshot', () => {
|
||||
expect(el).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
it('sets labels to translated label prop', () => {
|
||||
expect(btnProps.labels).toEqual({
|
||||
@@ -58,8 +58,8 @@ describe('NetworkButton component', () => {
|
||||
});
|
||||
describe('import icons', () => {
|
||||
it('sets icons with spinner pending icon and upload default', () => {
|
||||
el.setProps({ import: true });
|
||||
expect(el.find(StatefulButton).props().icons).toEqual({
|
||||
el = shallow(<NetworkButton {...props} import />);
|
||||
expect(el.instance.findByType(StatefulButton)[0].props.icons).toEqual({
|
||||
pending: (<Icon className="fa mr-2 fa-spinner fa-spin" />),
|
||||
default: (<Icon className="fa mr-2 fa-upload" />),
|
||||
});
|
||||
@@ -70,8 +70,8 @@ describe('NetworkButton component', () => {
|
||||
expect(btnProps.state).toEqual(buttonStates.default);
|
||||
});
|
||||
it('is set to pending state if props.showSpinner', () => {
|
||||
el.setProps({ showSpinner: true });
|
||||
expect(el.find(StatefulButton).props().state).toEqual(buttonStates.pending);
|
||||
el = shallow(<NetworkButton {...props} showSpinner />);
|
||||
expect(el.instance.findByType(StatefulButton)[0].props.state).toEqual(buttonStates.pending);
|
||||
expect(btnProps.state).toEqual(buttonStates.default);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ exports[`WithSidebar Component snapshots basic snapshot 1`] = `
|
||||
className="d-flex sidebar-container page-gradebook"
|
||||
>
|
||||
<aside
|
||||
className="sidebar-class-names"
|
||||
className="sidebar d-none"
|
||||
onTransitionEnd={[MockFunction handleSlideDone]}
|
||||
>
|
||||
<div>
|
||||
@@ -13,7 +13,7 @@ exports[`WithSidebar Component snapshots basic snapshot 1`] = `
|
||||
</div>
|
||||
</aside>
|
||||
<div
|
||||
className="content-class-names"
|
||||
className="sidebar-contents position-relative"
|
||||
>
|
||||
<b>
|
||||
aby in a bi
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
|
||||
import selectors from 'data/selectors';
|
||||
import thunkActions from 'data/thunkActions';
|
||||
@@ -56,30 +56,34 @@ describe('WithSidebar', () => {
|
||||
el = shallow(<WithSidebar {...props} />);
|
||||
});
|
||||
describe('sidebarClassNames', () => {
|
||||
const getVal = () => el.instance().sidebarClassNames.split(' ');
|
||||
const getVal = () => [
|
||||
...el.instance.props.className.split(' '),
|
||||
...el.instance.children[0].props.className.split(' '),
|
||||
...el.instance.children[1].props.className.split(' '),
|
||||
];
|
||||
it('returns a "sidebar" classname', () => {
|
||||
expect(getVal()).toContain('sidebar');
|
||||
});
|
||||
it('includes an open className iff props.open', () => {
|
||||
expect(getVal()).not.toContain('open');
|
||||
el.setProps({ open: true });
|
||||
el = shallow(<WithSidebar {...props} open />);
|
||||
expect(getVal()).toContain('open');
|
||||
});
|
||||
it('includes a d-none className iff props.isClosed', () => {
|
||||
expect(getVal()).toContain('d-none');
|
||||
el.setProps({ isClosed: false });
|
||||
el = shallow(<WithSidebar {...props} isClosed={false} />);
|
||||
expect(getVal()).not.toContain('d-none');
|
||||
});
|
||||
});
|
||||
describe('contentClassNames', () => {
|
||||
const getVal = () => el.instance().contentClassNames.split(' ');
|
||||
const getVal = () => el.instance.children[1].props.className.split(' ');
|
||||
it('includes sidebar-contents and position-relative classNames', () => {
|
||||
expect(getVal()).toContain('sidebar-contents');
|
||||
expect(getVal()).toContain('position-relative');
|
||||
});
|
||||
it('includes an opening class iff props.isOpening', () => {
|
||||
expect(getVal()).not.toContain('opening');
|
||||
el.setProps({ isOpening: true });
|
||||
el = shallow(<WithSidebar {...props} isOpening />);
|
||||
expect(getVal()).toContain('opening');
|
||||
});
|
||||
});
|
||||
@@ -87,11 +91,7 @@ describe('WithSidebar', () => {
|
||||
describe('snapshots', () => {
|
||||
test('basic snapshot', () => {
|
||||
const el = shallow(<WithSidebar {...props} />);
|
||||
const sidebarClassNames = 'sidebar-class-names';
|
||||
const contentClassNames = 'content-class-names';
|
||||
jest.spyOn(el.instance(), 'sidebarClassNames', 'get').mockReturnValue(sidebarClassNames);
|
||||
jest.spyOn(el.instance(), 'contentClassNames', 'get').mockReturnValue(contentClassNames);
|
||||
expect(el.instance().render()).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ exports[`GradebookPage component snapshot - shows BulkManagementHistoryView if a
|
||||
<WithSidebar
|
||||
sidebar={
|
||||
<GradebookFilters
|
||||
updateQueryParams={[MockFunction updateQueryParams]}
|
||||
updateQueryParams={[Function]}
|
||||
/>
|
||||
}
|
||||
>
|
||||
@@ -21,7 +21,7 @@ exports[`GradebookPage component snapshot - shows GradesView if aciveView === vi
|
||||
<WithSidebar
|
||||
sidebar={
|
||||
<GradebookFilters
|
||||
updateQueryParams={[MockFunction updateQueryParams]}
|
||||
updateQueryParams={[Function]}
|
||||
/>
|
||||
}
|
||||
>
|
||||
@@ -30,7 +30,7 @@ exports[`GradebookPage component snapshot - shows GradesView if aciveView === vi
|
||||
>
|
||||
<GradebookHeader />
|
||||
<GradesView
|
||||
updateQueryParams={[MockFunction updateQueryParams]}
|
||||
updateQueryParams={[Function]}
|
||||
/>
|
||||
</div>
|
||||
</WithSidebar>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* eslint-disable import/no-named-as-default */
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { render } from '@testing-library/react'; // eslint-disable-line import/no-extraneous-dependencies
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import queryString from 'query-string';
|
||||
|
||||
import selectors from 'data/selectors';
|
||||
@@ -62,13 +63,11 @@ describe('GradebookPage', () => {
|
||||
});
|
||||
test('snapshot - shows BulkManagementHistoryView if activeView === views.bulkManagementHistory', () => {
|
||||
el = shallow(<GradebookPage {...props} activeView={views.bulkManagementHistory} />);
|
||||
el.instance().updateQueryParams = jest.fn().mockName('updateQueryParams');
|
||||
expect(el.instance().render()).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
test('snapshot - shows GradesView if aciveView === views.grades', () => {
|
||||
el = shallow(<GradebookPage {...props} />);
|
||||
el.instance().updateQueryParams = jest.fn().mockName('updateQueryParams');
|
||||
expect(el.instance().render()).toMatchSnapshot();
|
||||
expect(el.snapshot).toMatchSnapshot();
|
||||
});
|
||||
describe('render', () => {
|
||||
beforeEach(() => {
|
||||
@@ -76,9 +75,9 @@ describe('GradebookPage', () => {
|
||||
});
|
||||
describe('top-level WithSidebar', () => {
|
||||
test('sidebar from GradebookFilters, with updateQueryParams', () => {
|
||||
const { sidebar } = el.props();
|
||||
expect(sidebar).toEqual(
|
||||
<GradebookFilters updateQueryParams={el.instance().updateQueryParams} />,
|
||||
const { sidebar } = el.instance.props;
|
||||
expect(sidebar).toMatchObject(
|
||||
<GradebookFilters updateQueryParams={el.shallowWrapper.props.sidebar.props.updateQueryParams} />,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -86,37 +85,37 @@ describe('GradebookPage', () => {
|
||||
let content;
|
||||
let children;
|
||||
beforeEach(() => {
|
||||
content = el.props().children;
|
||||
children = content.props.children;
|
||||
content = el.instance.children;
|
||||
children = content[0].children;
|
||||
});
|
||||
it('is wrapped in a div w/ px-3 gradebook-content classNames', () => {
|
||||
expect(content.type).toEqual('div');
|
||||
expect(content.props.className).toEqual('px-3 gradebook-content');
|
||||
expect(content[0].type).toEqual('div');
|
||||
expect(content[0].props.className).toEqual('px-3 gradebook-content');
|
||||
});
|
||||
it('displays Gradebook header and then tabs', () => {
|
||||
expect(children[0]).toEqual(<GradebookHeader />);
|
||||
expect(shallow(children[0])).toEqual(shallow(<GradebookHeader />));
|
||||
});
|
||||
it('displays GradesView if activeView === views.grades', () => {
|
||||
expect(shallow(children[1])).toEqual(shallow((
|
||||
<GradesView updateQueryParams={el.instance().updateQueryParams} />
|
||||
<GradesView updateQueryParams={el.shallowWrapper.props.sidebar.props.updateQueryParams} />
|
||||
)));
|
||||
});
|
||||
it('displays Bulk Management History View if activeView === views.bulkManagementHistory', () => {
|
||||
el = shallow(<GradebookPage {...props} activeView={views.bulkManagementHistory} />);
|
||||
const mainView = el.props().children.props.children[1];
|
||||
expect(mainView).toEqual((
|
||||
<BulkManagementHistoryView />
|
||||
const mainView = el.instance.children[0].children[1];
|
||||
expect(shallow(mainView)).toEqual(shallow(
|
||||
<BulkManagementHistoryView />,
|
||||
));
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('behavior', () => {
|
||||
beforeEach(() => {
|
||||
el = shallow(<GradebookPage {...props} />, { disableLifecucleMethods: true });
|
||||
el = shallow(<GradebookPage {...props} />);
|
||||
});
|
||||
describe('componentDidMount', () => {
|
||||
test('initializes app with courseId and urlQuery', () => {
|
||||
el.instance().componentDidMount();
|
||||
render(<GradebookPage {...props} />);
|
||||
expect(props.initializeApp).toHaveBeenCalledWith(
|
||||
courseId,
|
||||
queryString.parse(props.location.search),
|
||||
@@ -130,7 +129,7 @@ describe('GradebookPage', () => {
|
||||
const val1 = 'VALUE';
|
||||
const val2 = 'VALTWO!!';
|
||||
const args = { [newKey]: val1, [props.location.search]: val2 };
|
||||
el.instance().updateQueryParams(args);
|
||||
el.shallowWrapper.props.sidebar.props.updateQueryParams(args);
|
||||
expect(props.navigate).toHaveBeenCalledWith({ pathname: '/', search: `?${queryString.stringify(args)}` });
|
||||
});
|
||||
it('clears values for non-truthy values', () => {
|
||||
@@ -139,7 +138,7 @@ describe('GradebookPage', () => {
|
||||
const val1 = 'VALUE';
|
||||
const val2 = false;
|
||||
const args = { [newKey]: val1, [props.location.search]: val2 };
|
||||
el.instance().updateQueryParams(args);
|
||||
el.shallowWrapper.props.sidebar.props.updateQueryParams(args);
|
||||
expect(props.navigate).toHaveBeenCalledWith(
|
||||
{ pathname: '/', search: `?${queryString.stringify({ [newKey]: val1 })}` },
|
||||
);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { Helmet } from 'react-helmet';
|
||||
import { shallow } from '@edx/react-unit-test-utils';
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
import Head from './Head';
|
||||
|
||||
@@ -21,11 +20,10 @@ getConfig.mockReturnValue(config);
|
||||
describe('Head', () => {
|
||||
it('should match render title tag and favicon with the site configuration values', () => {
|
||||
const el = shallow(<Head />);
|
||||
const helmet = el.find(Helmet);
|
||||
const title = helmet.find('title');
|
||||
const link = el.find('link');
|
||||
expect(title.props().children).toEqual(`Gradebook | ${config.SITE_NAME}`);
|
||||
expect(link.props().rel).toEqual('shortcut icon');
|
||||
expect(link.props().href).toEqual(config.FAVICON_URL);
|
||||
const title = el.instance.findByType('title')[0];
|
||||
const link = el.instance.findByType('link')[0];
|
||||
expect(title.children[0].el).toEqual(`Gradebook | ${config.SITE_NAME}`);
|
||||
expect(link.props.rel).toEqual('shortcut icon');
|
||||
expect(link.props.href).toEqual(config.FAVICON_URL);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
import Enzyme from 'enzyme';
|
||||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
||||
// These configuration values are usually set in webpack's EnvironmentPlugin however
|
||||
// Jest does not use webpack so we need to set these so for testing
|
||||
process.env.LMS_BASE_URL = 'http://localhost:18000';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import { fireEvent, render } from '@testing-library/react';
|
||||
|
||||
import { withLocation, withNavigate } from './hoc';
|
||||
|
||||
@@ -20,19 +20,19 @@ const MockComponent = ({ navigate, location }) => (
|
||||
const WrappedComponent = withNavigate(withLocation(MockComponent));
|
||||
|
||||
test('Provide Navigation to Component', () => {
|
||||
const wrapper = mount(
|
||||
const wrapper = render(
|
||||
<WrappedComponent />,
|
||||
);
|
||||
const btn = wrapper.find('#btn');
|
||||
btn.simulate('click');
|
||||
const btn = wrapper.container.querySelector('#btn');
|
||||
fireEvent.click(btn);
|
||||
|
||||
expect(mockedNavigator).toHaveBeenCalledWith('/some-route');
|
||||
});
|
||||
|
||||
test('Provide Location object to Component', () => {
|
||||
const wrapper = mount(
|
||||
const wrapper = render(
|
||||
<WrappedComponent />,
|
||||
);
|
||||
|
||||
expect(wrapper.find('#btn').text()).toContain('/current-location');
|
||||
expect(wrapper.container.querySelector('#btn').textContent).toContain('/current-location');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user