chore: add expect to eslintrc

This commit is contained in:
Mangesh-Khairnar 2019-03-26 16:59:34 +05:30
parent 0608c6b956
commit cb47502fb9
4 changed files with 35 additions and 33 deletions

View file

@ -137,6 +137,7 @@
"Cypress": true,
"cy": true,
"it": true,
"expect": true,
"context": true,
"before": true,
"beforeEach": true

View file

@ -6,7 +6,8 @@ context('Rating Control', () => {
it('click on the star rating to record value', () => {
cy.visit('/desk')
cy.dialog('Rating', {
'fieldname': 'rate', 'fieldtype': 'Rating',
'fieldname': 'rate',
'fieldtype': 'Rating',
}).as('dialog');
cy.get('div.rating')
@ -16,14 +17,15 @@ context('Rating Control', () => {
.should('have.class', 'star-click');
cy.get('@dialog').then(dialog => {
var value = dialog.get_value('rate');
expect(value).to.equal(1)
expect(value).to.equal(1);
})
});
it('hover on the star', () => {
cy.visit('/desk')
cy.dialog('Rating', {
'fieldname': 'rate', 'fieldtype': 'Rating',
'fieldname': 'rate',
'fieldtype': 'Rating',
})
cy.get('div.rating')
.children('i.fa')
@ -33,5 +35,4 @@ context('Rating Control', () => {
.invoke('trigger', 'mouseleave')
.should('not.have.class', 'star-hover');
});
});

View file

@ -74,6 +74,6 @@ Cypress.Commands.add('dialog', (title, fields) => {
}
});
d.show();
return d
return d;
});
});

View file

@ -52,7 +52,7 @@ 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 `
<div class="rating">
${Array.from(new Array(5)).map((_, i) =>