From 6645589cdf7682c327b4015e057def2bb397ceff Mon Sep 17 00:00:00 2001 From: Dirk van der Laarse Date: Sun, 30 Jul 2023 15:48:03 +0000 Subject: [PATCH] chore: linting fixes --- cypress/integration/control_attach.js | 30 +++++++++++++-------------- frappe/public/js/frappe/ui/capture.js | 11 ++++------ 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/cypress/integration/control_attach.js b/cypress/integration/control_attach.js index d6086c9ed1..6714f6c24e 100644 --- a/cypress/integration/control_attach.js +++ b/cypress/integration/control_attach.js @@ -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"); - }); }); diff --git a/frappe/public/js/frappe/ui/capture.js b/frappe/public/js/frappe/ui/capture.js index 8309ffeeb8..dc4804be52 100644 --- a/frappe/public/js/frappe/ui/capture.js +++ b/frappe/public/js/frappe/ui/capture.js @@ -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(); } }