chore: linting fixes

This commit is contained in:
Dirk van der Laarse 2023-07-30 15:48:03 +00:00
parent c66d744824
commit 6645589cdf
2 changed files with 18 additions and 23 deletions

View file

@ -95,17 +95,17 @@ context("Attach Control", () => {
it('Checking that "Camera" button in the "Attach" fieldtype does show if camera is available', () => {
//Navigating to the new form for the newly created doctype
let doctype = "Test Attach Control"
let doctype = "Test Attach Control";
let dt_in_route = doctype.toLowerCase().replace(/ /g, "-");
cy.visit(`/app/${dt_in_route}/new`, {
onBeforeLoad (win) {
// Mock "window.navigator.mediaDevices" property
// to return mock mediaDevices object
win.navigator.mediaDevices = {
ondevicechange: null
}
}
});
onBeforeLoad(win) {
// Mock "window.navigator.mediaDevices" property
// to return mock mediaDevices object
win.navigator.mediaDevices = {
ondevicechange: null,
};
},
});
cy.get("body").should("have.attr", "data-route", `Form/${doctype}/new-${dt_in_route}-1`);
cy.get("body").should("have.attr", "data-ajax-state", "complete");
@ -114,19 +114,18 @@ context("Attach Control", () => {
//Clicking on "Camera" button
cy.findByRole("button", { name: "Camera" }).should("exist");
});
it('Checking that "Camera" button in the "Attach" fieldtype does not show if no camera is available', () => {
//Navigating to the new form for the newly created doctype
let doctype = "Test Attach Control"
let doctype = "Test Attach Control";
let dt_in_route = doctype.toLowerCase().replace(/ /g, "-");
cy.visit(`/app/${dt_in_route}/new`, {
onBeforeLoad (win) {
onBeforeLoad(win) {
// Delete "window.navigator.mediaDevices" property
delete win.navigator.mediaDevices
}
});
delete win.navigator.mediaDevices;
},
});
cy.get("body").should("have.attr", "data-route", `Form/${doctype}/new-${dt_in_route}-1`);
cy.get("body").should("have.attr", "data-ajax-state", "complete");
@ -135,6 +134,5 @@ context("Attach Control", () => {
//Clicking on "Camera" button
cy.findByRole("button", { name: "Camera" }).should("not.exist");
});
});

View file

@ -78,13 +78,10 @@ frappe.ui.Capture = class {
if (cint(frappe.boot.sysdefaults.force_web_capture_mode_for_uploads)) {
this.show_for_desktop();
}
else {
if (frappe.is_mobile()) {
this.show_for_mobile();
} else {
this.show_for_desktop();
}
} else if (frappe.is_mobile()) {
this.show_for_mobile();
} else {
this.show_for_desktop();
}
}