@angular/cdk
Version:
Angular Material Component Development Kit
30 lines • 7.07 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("@angular/cdk/testing"),require("protractor")):"function"==typeof define&&define.amd?define("@angular/cdk/testing/protractor",["exports","tslib","@angular/cdk/testing","protractor"],t):t(((e=e||self).ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.testing=e.ng.cdk.testing||{},e.ng.cdk.testing.protractor={}),e.tslib,e.ng.cdk.testing,e.protractor)}(this,(function(e,t,r,n){"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/var o,i=((o={})[r.TestKey.BACKSPACE]=n.Key.BACK_SPACE,o[r.TestKey.TAB]=n.Key.TAB,o[r.TestKey.ENTER]=n.Key.ENTER,o[r.TestKey.SHIFT]=n.Key.SHIFT,o[r.TestKey.CONTROL]=n.Key.CONTROL,o[r.TestKey.ALT]=n.Key.ALT,o[r.TestKey.ESCAPE]=n.Key.ESCAPE,o[r.TestKey.PAGE_UP]=n.Key.PAGE_UP,o[r.TestKey.PAGE_DOWN]=n.Key.PAGE_DOWN,o[r.TestKey.END]=n.Key.END,o[r.TestKey.HOME]=n.Key.HOME,o[r.TestKey.LEFT_ARROW]=n.Key.ARROW_LEFT,o[r.TestKey.UP_ARROW]=n.Key.ARROW_UP,o[r.TestKey.RIGHT_ARROW]=n.Key.ARROW_RIGHT,o[r.TestKey.DOWN_ARROW]=n.Key.ARROW_DOWN,o[r.TestKey.INSERT]=n.Key.INSERT,o[r.TestKey.DELETE]=n.Key.DELETE,o[r.TestKey.F1]=n.Key.F1,o[r.TestKey.F2]=n.Key.F2,o[r.TestKey.F3]=n.Key.F3,o[r.TestKey.F4]=n.Key.F4,o[r.TestKey.F5]=n.Key.F5,o[r.TestKey.F6]=n.Key.F6,o[r.TestKey.F7]=n.Key.F7,o[r.TestKey.F8]=n.Key.F8,o[r.TestKey.F9]=n.Key.F9,o[r.TestKey.F10]=n.Key.F10,o[r.TestKey.F11]=n.Key.F11,o[r.TestKey.F12]=n.Key.F12,o[r.TestKey.META]=n.Key.META,o);function s(e){var t=[];return e.control&&t.push(n.Key.CONTROL),e.alt&&t.push(n.Key.ALT),e.shift&&t.push(n.Key.SHIFT),e.meta&&t.push(n.Key.META),t}var u=function(){function e(e){this.element=e}return e.prototype.blur=function(){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(e){return[2,n.browser.executeScript("arguments[0].blur()",this.element)]}))}))},e.prototype.clear=function(){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(e){return[2,this.element.clear()]}))}))},e.prototype.click=function(e,r){return void 0===e&&(e=0),void 0===r&&(r=0),t.__awaiter(this,void 0,void 0,(function(){var o,i;return t.__generator(this,(function(t){switch(t.label){case 0:return i=(o=n.browser.actions()).mouseMove,[4,this.element.getWebElement()];case 1:return[4,i.apply(o,[t.sent(),{x:e,y:r}]).click().perform()];case 2:return t.sent(),[2]}}))}))},e.prototype.focus=function(){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(e){return[2,n.browser.executeScript("arguments[0].focus()",this.element)]}))}))},e.prototype.getCssValue=function(e){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(t){return[2,this.element.getCssValue(e)]}))}))},e.prototype.hover=function(){return t.__awaiter(this,void 0,void 0,(function(){var e,r;return t.__generator(this,(function(t){switch(t.label){case 0:return r=(e=n.browser.actions()).mouseMove,[4,this.element.getWebElement()];case 1:return[2,r.apply(e,[t.sent()]).perform()]}}))}))},e.prototype.sendKeys=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.__awaiter(this,void 0,void 0,(function(){var r,o,u,c,a,y;return t.__generator(this,(function(f){return"string"!=typeof(r=e[0])&&"number"!=typeof r?(o=r,u=e.slice(1)):(o={},u=e),c=s(o),a=u.map((function(e){return"string"==typeof e?e.split(""):[i[e]]})).reduce((function(e,t){return e.concat(t)}),[]).map((function(e){return n.Key.chord.apply(n.Key,t.__spread(c,[e]))})),[2,(y=this.element).sendKeys.apply(y,t.__spread(a))]}))}))},e.prototype.text=function(){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(e){return[2,this.element.getText()]}))}))},e.prototype.getAttribute=function(e){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(t){return[2,n.browser.executeScript("return arguments[0].getAttribute(arguments[1])",this.element,e)]}))}))},e.prototype.hasClass=function(e){return t.__awaiter(this,void 0,void 0,(function(){var r;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,this.getAttribute("class")];case 1:return r=t.sent()||"",[2,new Set(r.split(/\s+/).filter((function(e){return e}))).has(e)]}}))}))},e.prototype.getDimensions=function(){return t.__awaiter(this,void 0,void 0,(function(){var e,r,n,o;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,this.element.getSize()];case 1:return e=t.sent(),r=e.width,n=e.height,[4,this.element.getLocation()];case 2:return o=t.sent(),[2,{width:r,height:n,left:o.x,top:o.y}]}}))}))},e.prototype.getProperty=function(e){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(t){return[2,n.browser.executeScript("return arguments[0][arguments[1]]",this.element,e)]}))}))},e.prototype.matchesSelector=function(e){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(t){return[2,n.browser.executeScript("\n return (Element.prototype.matches ||\n Element.prototype.msMatchesSelector).call(arguments[0], arguments[1])\n ",this.element,e)]}))}))},e}(),c=function(e){function r(t){return e.call(this,t)||this}return t.__extends(r,e),r.loader=function(){return new r(n.element(n.by.css("body")))},r.prototype.forceStabilize=function(){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(e){return[2]}))}))},r.prototype.waitForTasksOutsideAngular=function(){return t.__awaiter(this,void 0,void 0,(function(){return t.__generator(this,(function(e){return[2]}))}))},r.prototype.getDocumentRoot=function(){return n.element(n.by.css("body"))},r.prototype.createTestElement=function(e){return new u(e)},r.prototype.createEnvironment=function(e){return new r(e)},r.prototype.getAllRawElements=function(e){return t.__awaiter(this,void 0,void 0,(function(){var r,o,i,s;return t.__generator(this,(function(t){switch(t.label){case 0:return[4,(r=this.rawRootElement.all(n.by.css(e))).count()];case 1:for(o=t.sent(),i=[],s=0;s<o;s++)i.push(r.get(s));return[2,i]}}))}))},r}(r.HarnessEnvironment);
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
e.ProtractorElement=u,e.ProtractorHarnessEnvironment=c,Object.defineProperty(e,"__esModule",{value:!0})}));