diff --git a/.eslintrc b/.eslintrc index ec8d486c1e..cdd6be1c0b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -137,6 +137,7 @@ "Cypress": true, "cy": true, "it": true, + "expect": true, "context": true, "before": true, "beforeEach": true diff --git a/cypress/integration/control_rating.js b/cypress/integration/control_rating.js index 7098bb9a77..62ddbe3e36 100644 --- a/cypress/integration/control_rating.js +++ b/cypress/integration/control_rating.js @@ -1,37 +1,38 @@ context('Rating Control', () => { beforeEach(() => { cy.login('Administrator', 'qwe'); - }); + }); - it('click on the star rating to record value', () => { - cy.visit('/desk') - cy.dialog('Rating', { - 'fieldname': 'rate', 'fieldtype': 'Rating', - }).as('dialog'); + it('click on the star rating to record value', () => { + cy.visit('/desk') + cy.dialog('Rating', { + 'fieldname': 'rate', + 'fieldtype': 'Rating', + }).as('dialog'); - cy.get('div.rating') - .children('i.fa') - .first() - .click() - .should('have.class', 'star-click'); - cy.get('@dialog').then(dialog => { - var value = dialog.get_value('rate'); - expect(value).to.equal(1) - }) - }); - - it('hover on the star', () => { - cy.visit('/desk') - cy.dialog('Rating', { - 'fieldname': 'rate', 'fieldtype': 'Rating', - }) - cy.get('div.rating') - .children('i.fa') - .first() - .invoke('trigger', 'mouseenter') - .should('have.class', 'star-hover') - .invoke('trigger', 'mouseleave') - .should('not.have.class', 'star-hover'); - }); + cy.get('div.rating') + .children('i.fa') + .first() + .click() + .should('have.class', 'star-click'); + cy.get('@dialog').then(dialog => { + var value = dialog.get_value('rate'); + expect(value).to.equal(1); + }) + }); + it('hover on the star', () => { + cy.visit('/desk') + cy.dialog('Rating', { + 'fieldname': 'rate', + 'fieldtype': 'Rating', + }) + cy.get('div.rating') + .children('i.fa') + .first() + .invoke('trigger', 'mouseenter') + .should('have.class', 'star-hover') + .invoke('trigger', 'mouseleave') + .should('not.have.class', 'star-hover'); + }); }); \ No newline at end of file diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 007d0d9f3e..ed81c182a6 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -74,6 +74,6 @@ Cypress.Commands.add('dialog', (title, fields) => { } }); d.show(); - return d + return d; }); }); diff --git a/frappe/public/js/frappe/form/formatters.js b/frappe/public/js/frappe/form/formatters.js index 34966b5eb5..23f9b932dc 100644 --- a/frappe/public/js/frappe/form/formatters.js +++ b/frappe/public/js/frappe/form/formatters.js @@ -52,12 +52,12 @@ frappe.form.formatters = { Percent: function(value, docfield, options) { return frappe.form.formatters._right(flt(value, 2) + "%", options) }, - Rating: function(value, docfield, options, doc) { + Rating: function(value, docfield, options) { return `
`; },