UNPKG

@angular/material

Version:
23 lines 5.75 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("tslib"),require("@angular/cdk/testing"),require("@angular/material/form-field/testing/control"),require("@angular/material/core/testing")):"function"==typeof define&&define.amd?define("@angular/material/select/testing",["exports","tslib","@angular/cdk/testing","@angular/material/form-field/testing/control","@angular/material/core/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.select=t.ng.material.select||{},t.ng.material.select.testing={}),t.tslib,t.ng.cdk.testing,t.ng.material.formField.testing.control,t.ng.material.core.testing)}(this,(function(t,e,r,n,i){"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=".mat-select-panel",s=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e._documentRootLocator=e.documentRootLocatorFactory(),e._backdrop=e._documentRootLocator.locatorFor(".cdk-overlay-backdrop"),e._optionalPanel=e._documentRootLocator.locatorForOptional(o),e._trigger=e.locatorFor(".mat-select-trigger"),e._value=e.locatorFor(".mat-select-value"),e}return e.__extends(n,t),n.with=function(t){return void 0===t&&(t={}),new r.HarnessPredicate(n,t)},n.prototype.isDisabled=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-select-disabled")]}}))}))},n.prototype.isValid=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[4,t.sent().hasClass("ng-invalid")];case 2:return[2,!t.sent()]}}))}))},n.prototype.isRequired=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-select-required")]}}))}))},n.prototype.isEmpty=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-select-empty")]}}))}))},n.prototype.isMultiple=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[4,t.sent().getAttribute("aria-multiselectable")];case 2:return[2,"true"===t.sent()]}}))}))},n.prototype.getValueText=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._value()];case 1:return[2,t.sent().text()]}}))}))},n.prototype.focus=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().focus()]}}))}))},n.prototype.blur=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().blur()]}}))}))},n.prototype.getOptions=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(r){return[2,this._documentRootLocator.locatorForAll(i.MatOptionHarness.with(e.__assign(e.__assign({},t),{ancestor:o})))()]}))}))},n.prototype.getOptionGroups=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(r){return[2,this._documentRootLocator.locatorForAll(i.MatOptgroupHarness.with(e.__assign(e.__assign({},t),{ancestor:o})))()]}))}))},n.prototype.isOpen=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._optionalPanel()];case 1:return[2,!!t.sent()]}}))}))},n.prototype.open=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.isOpen()];case 1:return t.sent()?[3,3]:[4,this._trigger()];case 2:return[2,t.sent().click()];case 3:return[2]}}))}))},n.prototype.clickOptions=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){var r,n,i;return e.__generator(this,(function(o){switch(o.label){case 0:return[4,this.open()];case 1:return o.sent(),[4,Promise.all([this.isMultiple(),this.getOptions(t)])];case 2:if(r=e.__read.apply(void 0,[o.sent(),2]),n=r[0],0===(i=r[1]).length)throw Error("Select does not have options matching the specified filter");return n?[4,Promise.all(i.map((function(t){return t.click()})))]:[3,4];case 3:return o.sent(),[3,6];case 4:return[4,i[0].click()];case 5:o.sent(),o.label=6;case 6:return[2]}}))}))},n.prototype.close=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.isOpen()];case 1:return t.sent()?[4,this._backdrop()]:[3,3];case 2:return[2,t.sent().click()];case 3:return[2]}}))}))},n.hostSelector=".mat-select",n}(n.MatFormFieldControlHarness); /** * @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 */ t.MatSelectHarness=s,Object.defineProperty(t,"__esModule",{value:!0})}));