UNPKG

@angular/material

Version:
36 lines 8.09 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/table/testing",["exports","tslib","@angular/cdk/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.table=t.ng.material.table||{},t.ng.material.table.testing={}),t.tslib,t.ng.cdk.testing)}(this,(function(t,e,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 r=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(n,t),n.with=function(t){return void 0===t&&(t={}),u(n,t)},n.prototype.getText=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().text()]}}))}))},n.prototype.getColumnName=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this.host()];case 1:return[4,e.sent().getAttribute("class")];case 2:if((t=e.sent())&&(n=t.split(" ").map((function(t){return t.trim()})).find((function(t){return t.startsWith("mat-column-")}))))return[2,n.split("mat-column-")[1]];throw Error("Could not determine column name of cell.")}}))}))},n.hostSelector=".mat-cell",n}(n.ComponentHarness),o=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(n,t),n.with=function(t){return void 0===t&&(t={}),u(n,t)},n.hostSelector=".mat-header-cell",n}(r),i=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(n,t),n.with=function(t){return void 0===t&&(t={}),u(n,t)},n.hostSelector=".mat-footer-cell",n}(r);function u(t,e){return new n.HarnessPredicate(t,e).addOption("text",e.text,(function(t,e){return n.HarnessPredicate.stringMatches(t.getText(),e)}))} /** * @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 a=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(o,t),o.with=function(t){return void 0===t&&(t={}),new n.HarnessPredicate(o,t)},o.prototype.getCells=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(r.with(t))()]}))}))},o.prototype.getCellTextByIndex=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,c(this,t)]}))}))},o.prototype.getCellTextByColumnName=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return[2,f(this)]}))}))},o.hostSelector=".mat-row",o}(n.ComponentHarness),s=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(r,t),r.with=function(t){return void 0===t&&(t={}),new n.HarnessPredicate(r,t)},r.prototype.getCells=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(o.with(t))()]}))}))},r.prototype.getCellTextByIndex=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,c(this,t)]}))}))},r.prototype.getCellTextByColumnName=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return[2,f(this)]}))}))},r.hostSelector=".mat-header-row",r}(n.ComponentHarness),l=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(r,t),r.with=function(t){return void 0===t&&(t={}),new n.HarnessPredicate(r,t)},r.prototype.getCells=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(i.with(t))()]}))}))},r.prototype.getCellTextByIndex=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,c(this,t)]}))}))},r.prototype.getCellTextByColumnName=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){return[2,f(this)]}))}))},r.hostSelector=".mat-footer-row",r}(n.ComponentHarness);function c(t,n){return e.__awaiter(this,void 0,void 0,(function(){var r;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,t.getCells(n)];case 1:return r=e.sent(),[2,Promise.all(r.map((function(t){return t.getText()})))]}}))}))}function f(t){return e.__awaiter(this,void 0,void 0,(function(){var n,r;return e.__generator(this,(function(o){switch(o.label){case 0:return n={},[4,t.getCells()];case 1:return r=o.sent(),[4,Promise.all(r.map((function(t){return Promise.all([t.getColumnName(),t.getText()])})))];case 2:return o.sent().forEach((function(t){var r=e.__read(t,2);return n[r[0]]=r[1]})),[2,n]}}))}))} /** * @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 h=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(r,t),r.with=function(t){return void 0===t&&(t={}),new n.HarnessPredicate(r,t)},r.prototype.getHeaderRows=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(s.with(t))()]}))}))},r.prototype.getRows=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(a.with(t))()]}))}))},r.prototype.getFooterRows=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(l.with(t))()]}))}))},r.prototype.getCellTextByIndex=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.getRows()];case 1:return t=e.sent(),[2,Promise.all(t.map((function(t){return t.getCellTextByIndex()})))]}}))}))},r.prototype.getCellTextByColumnName=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,u,a;return e.__generator(this,(function(s){switch(s.label){case 0:return[4,Promise.all([this.getHeaderRows(),this.getFooterRows(),this.getRows()])];case 1:return t=e.__read.apply(void 0,[s.sent(),3]),n=t[1],r=t[2],o={},[4,Promise.all([Promise.all(t[0].map((function(t){return t.getCellTextByColumnName()}))),Promise.all(n.map((function(t){return t.getCellTextByColumnName()}))),Promise.all(r.map((function(t){return t.getCellTextByColumnName()})))])];case 2:return i=e.__read.apply(void 0,[s.sent(),3]),u=i[0],a=i[1],i[2].forEach((function(t){Object.keys(t).forEach((function(e){var n=t[e];o[e]||(o[e]={headerText:d(u,e),footerText:d(a,e),text:[]}),o[e].text.push(n)}))})),[2,o]}}))}))},r.hostSelector=".mat-table",r}(n.ComponentHarness);function d(t,e){var n=[];return t.forEach((function(t){Object.keys(t).forEach((function(r){r===e&&n.push(t[r])}))})),n} /** * @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.MatCellHarness=r,t.MatFooterCellHarness=i,t.MatFooterRowHarness=l,t.MatHeaderCellHarness=o,t.MatHeaderRowHarness=s,t.MatRowHarness=a,t.MatTableHarness=h,Object.defineProperty(t,"__esModule",{value:!0})}));