Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

50 rader
1.5 KiB

  1. context('Control Icon', () => {
  2. before(() => {
  3. cy.login();
  4. cy.visit('/app/website');
  5. });
  6. function get_dialog_with_icon() {
  7. return cy.dialog({
  8. title: 'Icon',
  9. fields: [{
  10. label: 'Icon',
  11. fieldname: 'icon',
  12. fieldtype: 'Icon'
  13. }]
  14. });
  15. }
  16. it('should set icon', () => {
  17. get_dialog_with_icon().as('dialog');
  18. cy.get('.frappe-control[data-fieldname=icon]').findByRole('textbox').click();
  19. cy.get('.icon-picker .icon-wrapper[id=heart-active]').first().click();
  20. cy.get('.frappe-control[data-fieldname=icon]').findByRole('textbox').should('have.value', 'heart-active');
  21. cy.get('@dialog').then(dialog => {
  22. let value = dialog.get_value('icon');
  23. expect(value).to.equal('heart-active');
  24. });
  25. cy.get('.icon-picker .icon-wrapper[id=heart]').first().click();
  26. cy.get('.frappe-control[data-fieldname=icon]').findByRole('textbox').should('have.value', 'heart');
  27. cy.get('@dialog').then(dialog => {
  28. let value = dialog.get_value('icon');
  29. expect(value).to.equal('heart');
  30. });
  31. });
  32. it('search for icon and clear search input', () => {
  33. let search_text = 'ed';
  34. cy.get('.icon-picker').findByRole('searchbox').click().type(search_text);
  35. cy.get('.icon-section .icon-wrapper:not(.hidden)').then(i => {
  36. cy.get(`.icon-section .icon-wrapper[id*='${search_text}']`).then(icons => {
  37. expect(i.length).to.equal(icons.length);
  38. });
  39. });
  40. cy.get('.icon-picker').findByRole('searchbox').clear().blur();
  41. cy.get('.icon-section .icon-wrapper').should('not.have.class', 'hidden');
  42. });
  43. });