8000 Fix(fields): Automatically select field icons when editing a field by jonathanarnault · Pull Request #2433 · Inist-CNRS/lodex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix(fields): Automatically select field icons when editing a field #2433

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

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/lodex-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Lodex CI
# Run this ci only on pull request who targets master and on master branch only
on:
push:
branches: [ master ]
branches: [ master, v14 ]
pull_request:
branches: [ master ]
branches: [ master, v14 ]

jobs:
# Job use to create the test environment and run unit test suite
Expand Down
35 changes: 35 additions & 0 deletions cypress/e2e/phase_1/admin_display.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,39 @@ describe('Home Page', () => {
}).should('be.visible');
});
});

it('should select bound icons when editing a field', () => {
cy.findByRole('link', {
name: /Display/,
}).click();

fields.createNewField({
fieldIcons: ['Ressource'],
});

cy.findByRole('gridcell', {
name: /newField/,
timeout: 1000,
})
.should('be.visible')
.then((parent) => {
cy.findByTestId('HomeIcon', {
container: parent,
timeout: 500,
}).should('be.visible');

cy.findByTestId('ArticleIcon', {
container: parent,
timeout: 500,
}).should('be.visible');
});

cy.findByRole('gridcell', {
name: /newField/,
timeout: 1000,
}).click();

cy.get(`button[value="home"]`).should('have.class', 'Mui-selected');
cy.get(`button[value="document"]`).should('have.class', 'Mui-selected');
});
});
8 changes: 7 additions & 1 deletion cypress/support/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function setFieldLanguage(fieldName, languageCode) {
cy.wait(1000);
}

export function createNewField() {
export function createNewField({ fieldIcons = [] } = {}) {
cy.findByRole('button', {
name: /New field/,
}).click();
Expand All @@ -22,6 +22,12 @@ export function createNewField() {
timeout: 1000,
});

if (fieldIcons.length > 0) {
fieldIcons.forEach((label) => {
cy.get(`button > [aria-label="${label}"]`).click();
});
}

cy.findByRole('button', {
name: /Arbitrary value/,
}).click();
Expand Down
2 changes: 1 addition & 1 deletion src/app/js/fields/FieldToggleInternalScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { polyglot as polyglotPropTypes } from '../propTypes';
export const FieldToggleInternalScopeComponent = ({ input, p: polyglot }) => {
const matches = useRouteMatch();

const [values, setValues] = React.useState([]);
const [values, setValues] = React.useState(input?.value || []);

React.useEffect(() => {
if (!input) {
Expand Down
Loading
0