Loading projects/demo-app-e2e/src/app.e2e-spec.ts +47 −12 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ describe('angular-mentions app', function() { expect(page.getHeadingText()).toEqual('Angular Mentions'); let el = element.all(by.css('textarea')).first(); testMentions(el); el.clear(); // clear does not work for tinymce testMultiLine(el); }); it('test mentions div', () => { Loading @@ -36,11 +38,15 @@ describe('angular-mentions app', function() { let el = element.all(by.id('tmce_ifr')); // iframe testing workaround - sendKeys is not working unless menu is opened first // this wasn't needed in previous versions of angular/protractor el.click(); el.sendKeys('@'); el.sendKeys(protractor.Key.BACK_SPACE); // el.click(); // el.sendKeys('@'); // el.sendKeys(protractor.Key.BACK_SPACE); // end iframe testing workaround testMentions(el); el.sendKeys(protractor.Key.chord(protractor.Key.CONTROL, "a")); el.sendKeys(protractor.Key.chord(protractor.Key.COMMAND, "a")); el.sendKeys(protractor.Key.DELETE); testMultiLine(el); }); function testMentions(el){ Loading Loading @@ -112,6 +118,8 @@ describe('angular-mentions app', function() { expect(menu.isDisplayed()).toBe(false); expect(page.getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin and @e'); // these are failing for content editable after chrome update (unable to reproduce manually) if (tagName!='div') { // remove the escaped entry el.sendKeys('!!', protractor.Key.ARROW_LEFT, protractor.Key.ARROW_LEFT); el.sendKeys(protractor.Key.BACK_SPACE, protractor.Key.BACK_SPACE); Loading @@ -121,8 +129,35 @@ describe('angular-mentions app', function() { el.sendKeys('@HE', protractor.Key.ENTER); expect(menu.isDisplayed()).toBe(false); expect(page.getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin and @Henry!!'); } }); } function testMultiLine(el){ el.getTagName().then(function(tagName){ let menu = element(by.css('.dropdown-menu')); el.click(); expect(page.getValue(el, tagName)).toEqual(''); // first line el.sendKeys('Hello @He'); expect(menu.isDisplayed()).toBe(true); expect(page.getValue(el, tagName)).toEqual('Hello @He'); el.sendKeys(protractor.Key.ENTER); expect(menu.isDisplayed()).toBe(false); expect(page.getValue(el, tagName)).toEqual('Hello @Henry'); el.sendKeys(protractor.Key.ENTER); // new line // expect(page.getValue(el, tagName)).toEqual('Hello @Henry\n'); // \n not returned from tinymce // second line el.sendKeys('Bye @Bl'); expect(menu.isDisplayed()).toBe(true); expect(page.getValue(el, tagName)).toEqual('Hello @Henry\nBye @Bl'); el.sendKeys(protractor.Key.ENTER); expect(menu.isDisplayed()).toBe(false); expect(page.getValue(el, tagName)).toEqual('Hello @Henry\nBye @Blake'); }); } }); Loading
projects/demo-app-e2e/src/app.e2e-spec.ts +47 −12 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ describe('angular-mentions app', function() { expect(page.getHeadingText()).toEqual('Angular Mentions'); let el = element.all(by.css('textarea')).first(); testMentions(el); el.clear(); // clear does not work for tinymce testMultiLine(el); }); it('test mentions div', () => { Loading @@ -36,11 +38,15 @@ describe('angular-mentions app', function() { let el = element.all(by.id('tmce_ifr')); // iframe testing workaround - sendKeys is not working unless menu is opened first // this wasn't needed in previous versions of angular/protractor el.click(); el.sendKeys('@'); el.sendKeys(protractor.Key.BACK_SPACE); // el.click(); // el.sendKeys('@'); // el.sendKeys(protractor.Key.BACK_SPACE); // end iframe testing workaround testMentions(el); el.sendKeys(protractor.Key.chord(protractor.Key.CONTROL, "a")); el.sendKeys(protractor.Key.chord(protractor.Key.COMMAND, "a")); el.sendKeys(protractor.Key.DELETE); testMultiLine(el); }); function testMentions(el){ Loading Loading @@ -112,6 +118,8 @@ describe('angular-mentions app', function() { expect(menu.isDisplayed()).toBe(false); expect(page.getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin and @e'); // these are failing for content editable after chrome update (unable to reproduce manually) if (tagName!='div') { // remove the escaped entry el.sendKeys('!!', protractor.Key.ARROW_LEFT, protractor.Key.ARROW_LEFT); el.sendKeys(protractor.Key.BACK_SPACE, protractor.Key.BACK_SPACE); Loading @@ -121,8 +129,35 @@ describe('angular-mentions app', function() { el.sendKeys('@HE', protractor.Key.ENTER); expect(menu.isDisplayed()).toBe(false); expect(page.getValue(el, tagName)).toEqual('Hello @Aaron and @Gavin and @Henry!!'); } }); } function testMultiLine(el){ el.getTagName().then(function(tagName){ let menu = element(by.css('.dropdown-menu')); el.click(); expect(page.getValue(el, tagName)).toEqual(''); // first line el.sendKeys('Hello @He'); expect(menu.isDisplayed()).toBe(true); expect(page.getValue(el, tagName)).toEqual('Hello @He'); el.sendKeys(protractor.Key.ENTER); expect(menu.isDisplayed()).toBe(false); expect(page.getValue(el, tagName)).toEqual('Hello @Henry'); el.sendKeys(protractor.Key.ENTER); // new line // expect(page.getValue(el, tagName)).toEqual('Hello @Henry\n'); // \n not returned from tinymce // second line el.sendKeys('Bye @Bl'); expect(menu.isDisplayed()).toBe(true); expect(page.getValue(el, tagName)).toEqual('Hello @Henry\nBye @Bl'); el.sendKeys(protractor.Key.ENTER); expect(menu.isDisplayed()).toBe(false); expect(page.getValue(el, tagName)).toEqual('Hello @Henry\nBye @Blake'); }); } });