Compare commits
8 Commits
open-relea
...
jawayria/b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8b015f5de | ||
|
|
da4e44bafb | ||
|
|
913578ede2 | ||
|
|
d0d982743e | ||
|
|
af2ece8290 | ||
|
|
620827d772 | ||
|
|
c6a4685bf5 | ||
|
|
8dd2237f9c |
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@@ -3,17 +3,17 @@ name: node_js CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- "**"
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
node: [12, 14, 16]
|
||||
node: [16]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -56,4 +56,5 @@ jobs:
|
||||
subject: CI workflow failed in ${{github.repository}}
|
||||
to: masters-grades@edx.org
|
||||
from: github-actions <github-actions@edx.org>
|
||||
body: CI workflow in ${{github.repository}} failed! For details see "github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
body: CI workflow in ${{github.repository}} failed! For details see "github.com/${{
|
||||
github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
|
||||
13
.github/workflows/lockfileversion-check.yml
vendored
Normal file
13
.github/workflows/lockfileversion-check.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
#check package-lock file version
|
||||
|
||||
name: Lockfile Version check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
version-check:
|
||||
uses: edx/.github/.github/workflows/lockfileversion-check.yml@master
|
||||
2
Makefile
2
Makefile
@@ -14,7 +14,7 @@ tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transi
|
||||
# This directory must match .babelrc .
|
||||
transifex_temp = ./temp/babel-plugin-react-intl
|
||||
|
||||
NPM_TESTS=build i18n_extract lint test is-es5
|
||||
NPM_TESTS=build i18n_extract lint test
|
||||
|
||||
.PHONY: test
|
||||
test: $(addprefix test.npm.,$(NPM_TESTS)) ## validate ci suite
|
||||
|
||||
@@ -25,9 +25,6 @@ This is important because `npm` uses the pinned dependencies in your `package-lo
|
||||
|
||||
However, when these changes surface within a CI build, this indicates differing dependency expectations between the committed `package.json` file and the `package-lock.json` file, which is a good reason to fail a build.
|
||||
|
||||
### What is this `npm run is-es5` check?
|
||||
|
||||
This project outputs production files to the `dist` folder. The `npm script`, `npm run is-es5`, checks the JavaScript files in the `dist` folder to make sure that they are `ES5`-compliant.
|
||||
|
||||
This check is important because `ES5` JavaScript has [greater browser compatibility](http://kangax.github.io/compat-table/es5/) than [`ES2015+`](http://kangax.github.io/compat-table/es6/) - particularly for `IE11`.
|
||||
|
||||
|
||||
41018
package-lock.json
generated
41018
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,6 @@
|
||||
"scripts": {
|
||||
"build": "fedx-scripts webpack",
|
||||
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
||||
"is-es5": "es-check es5 ./dist/*.js",
|
||||
"i18n_extract": "BABEL_ENV=i18n fedx-scripts babel src --quiet > /dev/null",
|
||||
"lint": "fedx-scripts eslint --ext .jsx,.js src/",
|
||||
"lint-fix": "fedx-scripts eslint --fix --ext .jsx,.js src/",
|
||||
@@ -26,9 +25,7 @@
|
||||
"access": "public"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 2 versions",
|
||||
"not ie > 0",
|
||||
"not ie_mob > 0"
|
||||
"extends @edx/browserslist-config"
|
||||
],
|
||||
"dependencies": {
|
||||
"@edx/brand": "npm:@edx/brand-edx.org@^1.3.2",
|
||||
@@ -69,12 +66,12 @@
|
||||
"whatwg-fetch": "^2.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@edx/browserslist-config": "1.0.0",
|
||||
"@edx/frontend-build": "9.1.1",
|
||||
"axios": "0.21.1",
|
||||
"axios-mock-adapter": "^1.17.0",
|
||||
"codecov": "^3.6.1",
|
||||
"enzyme-adapter-react-16": "^1.14.0",
|
||||
"es-check": "^2.3.0",
|
||||
"fetch-mock": "^6.5.2",
|
||||
"husky": "2.7.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
|
||||
@@ -20,28 +20,15 @@ export class AdjustedGradeInput extends React.Component {
|
||||
}
|
||||
|
||||
onChange = ({ target }) => {
|
||||
let adjustedGradeValue;
|
||||
switch (true) {
|
||||
case target.value < 0:
|
||||
adjustedGradeValue = 0;
|
||||
break;
|
||||
case this.props.possibleGrade && target.value > this.props.possibleGrade:
|
||||
adjustedGradeValue = this.props.possibleGrade;
|
||||
break;
|
||||
default:
|
||||
adjustedGradeValue = target.value;
|
||||
}
|
||||
this.props.setModalState({ adjustedGradeValue });
|
||||
this.props.setModalState({ adjustedGradeValue: target.value });
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<span>
|
||||
<Form.Control
|
||||
type="number"
|
||||
type="text"
|
||||
name="adjustedGradeValue"
|
||||
min="0"
|
||||
max={this.props.possibleGrade ? this.props.possibleGrade : ''}
|
||||
value={this.props.value}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
|
||||
@@ -54,34 +54,9 @@ describe('AdjustedGradeInput', () => {
|
||||
});
|
||||
describe('behavior', () => {
|
||||
describe('onChange', () => {
|
||||
it('calls props.setModalState event target value with correct value', () => {
|
||||
const value = 3;
|
||||
el.instance().onChange({ target: { value } });
|
||||
expect(props.setModalState).toHaveBeenCalledWith({
|
||||
adjustedGradeValue: value,
|
||||
});
|
||||
});
|
||||
|
||||
it('calls props.setModalState event target value with a value more then the possibleGrade value', () => {
|
||||
it('calls props.setModalState event target value', () => {
|
||||
const value = 42;
|
||||
el.instance().onChange({ target: { value } });
|
||||
expect(props.setModalState).toHaveBeenCalledWith({
|
||||
adjustedGradeValue: props.possibleGrade,
|
||||
});
|
||||
});
|
||||
|
||||
it('calls props.setModalState event target value with less then 0', () => {
|
||||
const value = -5;
|
||||
el.instance().onChange({ target: { value } });
|
||||
expect(props.setModalState).toHaveBeenCalledWith({
|
||||
adjustedGradeValue: 0,
|
||||
});
|
||||
});
|
||||
|
||||
it('calls props.setModalState event target value without possibleGrade value', () => {
|
||||
const value = 100;
|
||||
const newEl = shallow(<AdjustedGradeInput {...props} possibleGrade={null} />);
|
||||
newEl.instance().onChange({ target: { value } });
|
||||
expect(props.setModalState).toHaveBeenCalledWith({
|
||||
adjustedGradeValue: value,
|
||||
});
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
exports[`AdjustedGradeInput Component snapshots displays input control and "out of possible grade" label 1`] = `
|
||||
<span>
|
||||
<Control
|
||||
max={5}
|
||||
min="0"
|
||||
name="adjustedGradeValue"
|
||||
onChange={[MockFunction this.onChange]}
|
||||
type="number"
|
||||
type="text"
|
||||
value={1}
|
||||
/>
|
||||
/ 5
|
||||
|
||||
@@ -17,7 +17,7 @@ exports[`GradebookTable component snapshot - fields1 and 2 between email and tot
|
||||
Object {
|
||||
"key": "Email",
|
||||
"label": <FormattedMessage
|
||||
defaultMessage="Email*"
|
||||
defaultMessage="Email"
|
||||
description="Gradebook table email column header"
|
||||
id="gradebook.GradesView.table.headings.email"
|
||||
/>,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { defineMessages } from '@edx/frontend-platform/i18n';
|
||||
const messages = defineMessages({
|
||||
emailHeading: {
|
||||
id: 'gradebook.GradesView.table.headings.email',
|
||||
defaultMessage: 'Email*',
|
||||
defaultMessage: 'Email',
|
||||
description: 'Gradebook table email column header',
|
||||
},
|
||||
totalGradeHeading: {
|
||||
|
||||
@@ -18,17 +18,13 @@ import messages from './SearchControls.messages';
|
||||
export class SearchControls extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.onBlur = this.onBlur.bind(this);
|
||||
this.onChange = this.onChange.bind(this);
|
||||
this.onClear = this.onClear.bind(this);
|
||||
this.onSubmit = this.onSubmit.bind(this);
|
||||
}
|
||||
|
||||
/** Changing the search value stores the key in Gradebook. Currently unused */
|
||||
onBlur(e) {
|
||||
const { value } = e.target;
|
||||
if (this.props.searchValue !== value) {
|
||||
this.props.setSearchValue(value);
|
||||
}
|
||||
onChange(searchValue) {
|
||||
this.props.setSearchValue(searchValue);
|
||||
}
|
||||
|
||||
onClear() {
|
||||
@@ -36,20 +32,13 @@ export class SearchControls extends React.Component {
|
||||
this.props.fetchGrades();
|
||||
}
|
||||
|
||||
onSubmit(value) {
|
||||
if (this.props.searchValue !== value) {
|
||||
this.props.setSearchValue(value);
|
||||
}
|
||||
this.props.fetchGrades();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<SearchField
|
||||
onSubmit={this.onSubmit}
|
||||
onSubmit={this.props.fetchGrades}
|
||||
inputLabel={<FormattedMessage {...messages.label} />}
|
||||
onBlur={this.onBlur}
|
||||
onChange={this.onChange}
|
||||
onClear={this.onClear}
|
||||
value={this.props.searchValue}
|
||||
/>
|
||||
|
||||
@@ -52,25 +52,18 @@ describe('SearchControls', () => {
|
||||
describe('Snapshots', () => {
|
||||
test('basic snapshot', () => {
|
||||
const wrapper = searchControls();
|
||||
wrapper.instance().onBlur = jest.fn().mockName('onBlur');
|
||||
wrapper.instance().onChange = jest.fn().mockName('onChange');
|
||||
wrapper.instance().onClear = jest.fn().mockName('onClear');
|
||||
wrapper.instance().onSubmit = jest.fn().mockName('onSubmit');
|
||||
expect(wrapper.instance().render()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('onBlur', () => {
|
||||
describe('onChange', () => {
|
||||
it('saves the changed search value to Gradebook state', () => {
|
||||
const wrapper = searchControls();
|
||||
wrapper.instance().onBlur({ target: { value: 'bob' } });
|
||||
wrapper.instance().onChange('bob');
|
||||
expect(props.setSearchValue).toHaveBeenCalledWith('bob');
|
||||
});
|
||||
|
||||
it('doesnt save the same as previous value to Gradebook state', () => {
|
||||
const wrapper = searchControls({ searchValue: 'bob' });
|
||||
wrapper.instance().onBlur({ target: { value: 'bob' } });
|
||||
expect(props.setSearchValue).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('onChange', () => {
|
||||
@@ -82,22 +75,6 @@ describe('SearchControls', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('onSubmit', () => {
|
||||
it('saves the changed search value to Gradebook state and calls fetchGrades', () => {
|
||||
const wrapper = searchControls();
|
||||
wrapper.instance().onSubmit('bob');
|
||||
expect(props.setSearchValue).toHaveBeenCalledWith('bob');
|
||||
expect(props.fetchGrades).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('doesnt save the same as previous value to Gradebook state and calls fetchGrades', () => {
|
||||
const wrapper = searchControls({ searchValue: 'bob' });
|
||||
wrapper.instance().onSubmit('bob');
|
||||
expect(props.setSearchValue).not.toHaveBeenCalled();
|
||||
expect(props.fetchGrades).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('mapStateToProps', () => {
|
||||
const testState = { never: 'gonna', give: 'you up' };
|
||||
test('searchValue from app.searchValue', () => {
|
||||
|
||||
@@ -10,9 +10,9 @@ exports[`SearchControls Component Snapshots basic snapshot 1`] = `
|
||||
id="gradebook.GradesView.search.label"
|
||||
/>
|
||||
}
|
||||
onBlur={[MockFunction onBlur]}
|
||||
onChange={[MockFunction onChange]}
|
||||
onClear={[MockFunction onClear]}
|
||||
onSubmit={[MockFunction onSubmit]}
|
||||
onSubmit={[MockFunction fetchGrades]}
|
||||
value="alice"
|
||||
/>
|
||||
<small
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('app reducer', () => {
|
||||
const mockDate = new Date(8675309);
|
||||
let dateSpy;
|
||||
beforeEach(() => {
|
||||
dateSpy = jest.spyOn(global, 'Date').mockReturnValue(mockDate);
|
||||
dateSpy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate);
|
||||
});
|
||||
afterEach(() => {
|
||||
dateSpy.mockRestore();
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"gradebook.GradesView.EditModal.Overrides.reasonHeader": "Reason",
|
||||
"gradebook.GradesTab.usersVisibilityLabel'": "Showing {filteredUsers} of {totalUsers} total learners",
|
||||
"gradebook.GradesView.editFilterLabel": "Edit Filters",
|
||||
"gradebook.GradesView.table.headings.email": "Email*",
|
||||
"gradebook.GradesView.table.headings.email": "Email",
|
||||
"gradebook.GradesView.table.headings.totalGrade": "Total Grade (%)",
|
||||
"gradebook.GradesView.table.headings.username": "Username",
|
||||
"gradebook.GradesView.table.labels.studentKey": "Student Key*",
|
||||
@@ -70,4 +70,4 @@
|
||||
"gradebook.GradesTab.FilterBadges.courseGrade": "Course Grade",
|
||||
"gradebook.GradesTab.FilterBadges.includeCourseRoleMembers": "Include Course Team Members",
|
||||
"gradebook.GradesTab.FilterBadges.track": "Track"
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@
|
||||
"gradebook.GradesView.EditModal.Overrides.reasonHeader": "Reason",
|
||||
"gradebook.GradesTab.usersVisibilityLabel'": "Showing {filteredUsers} of {totalUsers} total learners",
|
||||
"gradebook.GradesView.editFilterLabel": "Edit Filters",
|
||||
"gradebook.GradesView.table.headings.email": "Email*",
|
||||
"gradebook.GradesView.table.headings.email": "Email",
|
||||
"gradebook.GradesView.table.headings.totalGrade": "Total Grade (%)",
|
||||
"gradebook.GradesView.table.headings.username": "Username",
|
||||
"gradebook.GradesView.table.labels.studentKey": "Student Key*",
|
||||
@@ -70,4 +70,4 @@
|
||||
"gradebook.GradesTab.FilterBadges.courseGrade": "Course Grade",
|
||||
"gradebook.GradesTab.FilterBadges.includeCourseRoleMembers": "Include Course Team Members",
|
||||
"gradebook.GradesTab.FilterBadges.track": "Track"
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@
|
||||
"gradebook.GradesView.EditModal.Overrides.reasonHeader": "Motif",
|
||||
"gradebook.GradesTab.usersVisibilityLabel'": "Showing {filteredUsers} of {totalUsers} total learners",
|
||||
"gradebook.GradesView.editFilterLabel": "Editer les filtres",
|
||||
"gradebook.GradesView.table.headings.email": "Email*",
|
||||
"gradebook.GradesView.table.headings.email": "Email",
|
||||
"gradebook.GradesView.table.headings.totalGrade": "Note totale (%)",
|
||||
"gradebook.GradesView.table.headings.username": "Nom d’utilisateur",
|
||||
"gradebook.GradesView.table.labels.studentKey": "Clé d'étudiant",
|
||||
@@ -70,4 +70,4 @@
|
||||
"gradebook.GradesTab.FilterBadges.courseGrade": "Note du cours",
|
||||
"gradebook.GradesTab.FilterBadges.includeCourseRoleMembers": "Include Course Team Members",
|
||||
"gradebook.GradesTab.FilterBadges.track": "Track"
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@
|
||||
"gradebook.GradesView.EditModal.Overrides.reasonHeader": "Reason",
|
||||
"gradebook.GradesTab.usersVisibilityLabel'": "Showing {filteredUsers} of {totalUsers} total learners",
|
||||
"gradebook.GradesView.editFilterLabel": "Edit Filters",
|
||||
"gradebook.GradesView.table.headings.email": "Email*",
|
||||
"gradebook.GradesView.table.headings.email": "Email",
|
||||
"gradebook.GradesView.table.headings.totalGrade": "Total Grade (%)",
|
||||
"gradebook.GradesView.table.headings.username": "Username",
|
||||
"gradebook.GradesView.table.labels.studentKey": "Student Key*",
|
||||
@@ -70,4 +70,4 @@
|
||||
"gradebook.GradesTab.FilterBadges.courseGrade": "Course Grade",
|
||||
"gradebook.GradesTab.FilterBadges.includeCourseRoleMembers": "Include Course Team Members",
|
||||
"gradebook.GradesTab.FilterBadges.track": "Track"
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@
|
||||
"gradebook.GradesView.EditModal.Overrides.reasonHeader": "Reason",
|
||||
"gradebook.GradesTab.usersVisibilityLabel'": "Showing {filteredUsers} of {totalUsers} total learners",
|
||||
"gradebook.GradesView.editFilterLabel": "Edit Filters",
|
||||
"gradebook.GradesView.table.headings.email": "Email*",
|
||||
"gradebook.GradesView.table.headings.email": "Email",
|
||||
"gradebook.GradesView.table.headings.totalGrade": "Total Grade (%)",
|
||||
"gradebook.GradesView.table.headings.username": "Username",
|
||||
"gradebook.GradesView.table.labels.studentKey": "Student Key*",
|
||||
@@ -70,4 +70,4 @@
|
||||
"gradebook.GradesTab.FilterBadges.courseGrade": "Course Grade",
|
||||
"gradebook.GradesTab.FilterBadges.includeCourseRoleMembers": "Include Course Team Members",
|
||||
"gradebook.GradesTab.FilterBadges.track": "Track"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user