Skip to content

Commit 645ac2c

Browse files
authored
fix: toggle notes visibility button state correctly (openedx#1170)
1 parent ee80b24 commit 645ac2c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/courseware/course/content-tools/notes-visibility/NotesVisibility.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class NotesVisibility extends Component {
2525
}
2626

2727
handleClick = () => {
28-
const data = { visibility: this.state.visible };
28+
const data = { visibility: !this.state.visible };
2929
getAuthenticatedHttpClient().put(
3030
this.visibilityUrl,
3131
data,

src/courseware/course/content-tools/notes-visibility/NotesVisibility.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('Notes Visibility', () => {
8585

8686
expect(axiosMock.history.put).toHaveLength(1);
8787
expect(axiosMock.history.put[0].url).toEqual(visibilityUrl);
88-
expect(axiosMock.history.put[0].data).toEqual(`{"visibility":${mockData.course.notes.visible}}`);
88+
expect(axiosMock.history.put[0].data).toEqual(`{"visibility":${!mockData.course.notes.visible}}`);
8989

9090
expect(screen.getByRole('switch', { name: 'Hide Notes' })).toBeInTheDocument();
9191
});

0 commit comments

Comments
 (0)