UNPKG

@angular/material

Version:
30 lines 4.2 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("tslib"),require("@angular/cdk/testing")):"function"==typeof define&&define.amd?define("@angular/material/sort/testing",["exports","tslib","@angular/cdk/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.sort=t.ng.material.sort||{},t.ng.material.sort.testing={}),t.tslib,t.ng.cdk.testing)}(this,(function(t,e,r){"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 n=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e._button=e.locatorFor(".mat-sort-header-button"),e}return e.__extends(n,t),n.with=function(t){return void 0===t&&(t={}),new r.HarnessPredicate(n,t).addOption("label",t.label,(function(t,e){return r.HarnessPredicate.stringMatches(t.getLabel(),e)})).addOption("sortDirection",t.sortDirection,(function(t,e){return r.HarnessPredicate.stringMatches(t.getSortDirection(),e)}))},n.prototype.getLabel=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._button()];case 1:return[2,t.sent().text()]}}))}))},n.prototype.getSortDirection=function(){return e.__awaiter(this,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this.host()];case 1:return[4,e.sent().getAttribute("aria-sort")];case 2:return"ascending"===(t=e.sent())?[2,"asc"]:"descending"===t?[2,"desc"]:[2,""]}}))}))},n.prototype.getAriaLabel=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._button()];case 1:return[2,t.sent().getAttribute("aria-label")]}}))}))},n.prototype.isActive=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this.getSortDirection()];case 1:return[2,!!t.sent()]}}))}))},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._button()];case 1:return[4,t.sent().getAttribute("disabled")];case 2:return[2,null!=t.sent()]}}))}))},n.prototype.click=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().click()]}}))}))},n.hostSelector=".mat-sort-header",n}(r.ComponentHarness),i=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(i,t),i.with=function(t){return void 0===t&&(t={}),new r.HarnessPredicate(i,t)},i.prototype.getSortHeaders=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,this.locatorForAll(n.with(t))()]}))}))},i.prototype.getActiveHeader=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,r;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this.getSortHeaders()];case 1:t=e.sent(),r=0,e.label=2;case 2:return r<t.length?[4,t[r].isActive()]:[3,5];case 3:if(e.sent())return[2,t[r]];e.label=4;case 4:return r++,[3,2];case 5:return[2,null]}}))}))},i.hostSelector=".mat-sort",i}(r.ComponentHarness); /** * @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 */ t.MatSortHarness=i,t.MatSortHeaderHarness=n,Object.defineProperty(t,"__esModule",{value:!0})}));