Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension buttons (simplified variant) #53

Merged
merged 13 commits into from
Dec 17, 2023
Merged

Conversation

blcham
Copy link

@blcham blcham commented Dec 17, 2023

This is same PR as #22 but rebased onto main to make cleaner history.

@blcham blcham merged commit 1fb10e4 into main Dec 17, 2023
2 checks passed
@@ -105,13 +106,34 @@ class Record extends React.Component {
const {record, recordSaved, formgen} = this.props;

return <div className="mt-3 text-center">
<Button variant='success' size='sm'
{record.phase === RECORD_PHASE.COMPLETED
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LaChope why are we using different mechanism to hide buttons as couple lines bellow where we use hidden attribute? I.e.:

<Button className="mx-1" variant='success' size='sm'
                    disabled={formgen.status === ACTION_STATUS.PENDING || recordSaved.status === ACTION_STATUS.PENDING
                        || !this.state.isFormValid || !record.state.isComplete()}
                    hidden={(record.phase === RECORD_PHASE.COMPLETED && !this._isAdmin()) ||
                        record.phase === RECORD_PHASE.PUBLISHED}
                    onClick={this.props.handlers.onSave}>
                {this.i18n('save')}{recordSaved.status === ACTION_STATUS.PENDING && <LoaderSmall/>}
            </Button>

Copy link
Collaborator

@LaChope LaChope Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blcham for consistency, the mechanism should be the same everywhere, I just forgot to change it in all places. It should be like in line 109{record.phase === RECORD_PHASE.COMPLETED for testing reasons. When using the hidden prop, the buttons are still present in the DOM, and thus breaking the tests.

@@ -7,7 +7,7 @@ import Records from "../../../js/components/record/Records";
import {ACTION_STATUS, ROLE} from "../../../js/constants/DefaultConstants";
import enLang from '../../../js/i18n/en';

describe('Records', function () {
describe.skip('Records', function () {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fix failing tests and enable it !

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I did it everywhere. I see you already created issue in #54

@@ -10,7 +10,7 @@ import enLang from '../../../js/i18n/en';

jest.mock("../../../js/components/record/TypeaheadAnswer", () =>() => <input />);

describe('Record', function () {
describe.skip('Record', function () {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to fix failing tests and enable it !

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just change failing test in a way that no extension will be expected.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as comment above.

@@ -110,6 +110,7 @@ describe('Record', function () {
}
});

//TODO (after migrating to React 18): Create test cases for different extension (operator and supplier cases)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this rather to ticket and not here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we fix tests we will know right away which tests are using which extensions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks, it will be dealt in #54

@@ -10,7 +10,7 @@ import enLang from '../../../js/i18n/en';

jest.mock("../../../js/components/record/TypeaheadAnswer", () =>() => <input />);

describe('Record', function () {
describe.skip('Record', function () {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just change failing test in a way that no extension will be expected.

@blcham blcham mentioned this pull request Dec 17, 2023
@blcham blcham deleted the add-role-buttons-simpliefied branch December 17, 2023 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants