{
expect(screen.queryByTitle("sidebar.expand")).not.toBeInTheDocument();
});
});
+
+describe("When there is an error after code has been run", () => {
+ beforeEach(() => {
+ const initialState = {
+ editor: {
+ project: {
+ project_type: "python",
+ components: [
+ {
+ name: "main",
+ extension: "py",
+ content: "print('hello')",
+ },
+ ],
+ image_list: [],
+ user_id: user.profile.user,
+ },
+ codeRunTriggered: false,
+ openFiles: [["main.py"]],
+ focussedFileIndices: [0],
+ error: "An error occurred",
+ },
+ auth: {
+ user: user,
+ },
+ };
+ const store = mockStore(initialState);
+ render(
+
+
+ ,
+ );
+ });
+
+ test("The input tab is selected", () => {
+ const inputTab = screen.getByText("mobile.code").parentElement;
+ expect(inputTab).toHaveClass("react-tabs__tab--selected");
+ });
+
+ test("The error message is displayed", () => {
+ expect(screen.getByText("An error occurred")).toBeInTheDocument();
+ });
+});
diff --git a/src/web-component.html b/src/web-component.html
index 0b637350d..cdc780a88 100644
--- a/src/web-component.html
+++ b/src/web-component.html
@@ -96,6 +96,7 @@
newWebComp.setAttribute("with_projectbar", "true");
newWebComp.setAttribute("with_sidebar", "true");
+ newWebComp.setAttribute("friendly_errors_enabled", "true");
newWebComp.setAttribute(
"sidebar_options",
JSON.stringify([