Skip to content

Commit

Permalink
fix(client): prevent load from local storage (freeCodeCamp#44440)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojeytonwilliams authored Dec 9, 2021
1 parent bf2b4ca commit fca626f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
4 changes: 3 additions & 1 deletion client/src/templates/Challenges/redux/code-storage-epic.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ function saveCodeEpic(action$, state$) {
);
}

// TODO: Ignored temporarily while we update the code storage UI
// eslint-disable-next-line no-unused-vars
function loadCodeEpic(action$, state$) {
return action$.pipe(
ofType(actionTypes.challengeMounted),
Expand Down Expand Up @@ -173,4 +175,4 @@ function loadCodeEpic(action$, state$) {
);
}

export default combineEpics(saveCodeEpic, loadCodeEpic, clearCodeEpic);
export default combineEpics(saveCodeEpic, clearCodeEpic);
27 changes: 14 additions & 13 deletions cypress/integration/learn/challenges/code-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ describe('Challenge with editor', function () {
cy.get('@editor', { timeout: 10000 }).contains(editorContents);
});

it('renders code from localStorage after "Ctrl + S"', () => {
const editorContents = `<h1>Hello</h1>`;
cy.get(selectors.editor).as('editor').contains(editorContents);
cy.get('@editor')
.click()
.focused()
.type(`{movetoend}<h1>Hello World</h1>{ctrl+s}`);
cy.contains("Saved! Your code was saved to your browser's local storage.");
cy.reload();
cy.get('@editor', { timeout: 10000 }).contains(
'<h1>Hello</h1><h1>Hello World</h1>'
);
});
// DISABLED until we update the local storage UI
// it('renders code from localStorage after "Ctrl + S"', () => {
// const editorContents = `<h1>Hello</h1>`;
// cy.get(selectors.editor).as('editor').contains(editorContents);
// cy.get('@editor')
// .click()
// .focused()
// .type(`{movetoend}<h1>Hello World</h1>{ctrl+s}`);
// cy.contains("Saved! Your code was saved to your browser's local storage.");
// cy.reload();
// cy.get('@editor', { timeout: 10000 }).contains(
// '<h1>Hello</h1><h1>Hello World</h1>'
// );
// });
});

0 comments on commit fca626f

Please sign in to comment.