UNPKG

@angular/material

Version:
30 lines 5.46 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("tslib"),require("@angular/cdk/testing"),require("@angular/material/grid-list")):"function"==typeof define&&define.amd?define("@angular/material/grid-list/testing",["exports","tslib","@angular/cdk/testing","@angular/material/grid-list"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.gridList=t.ng.material.gridList||{},t.ng.material.gridList.testing={}),t.tslib,t.ng.cdk.testing,t.ng.material.gridList)}(this,(function(t,e,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 i=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e._header=e.locatorForOptional(".mat-grid-tile-header"),e._footer=e.locatorForOptional(".mat-grid-tile-footer"),e._avatar=e.locatorForOptional(".mat-grid-avatar"),e}return e.__extends(n,t),n.with=function(t){return void 0===t&&(t={}),new r.HarnessPredicate(n,t).addOption("headerText",t.headerText,(function(t,e){return r.HarnessPredicate.stringMatches(t.getHeaderText(),e)})).addOption("footerText",t.footerText,(function(t,e){return r.HarnessPredicate.stringMatches(t.getFooterText(),e)}))},n.prototype.getRowspan=function(){return e.__awaiter(this,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return t=Number,[4,this.host()];case 1:return[4,e.sent().getAttribute("rowspan")];case 2:return[2,t.apply(void 0,[e.sent()])]}}))}))},n.prototype.getColspan=function(){return e.__awaiter(this,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return t=Number,[4,this.host()];case 1:return[4,e.sent().getAttribute("colspan")];case 2:return[2,t.apply(void 0,[e.sent()])]}}))}))},n.prototype.hasHeader=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._header()];case 1:return[2,null!==t.sent()]}}))}))},n.prototype.hasFooter=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._footer()];case 1:return[2,null!==t.sent()]}}))}))},n.prototype.hasAvatar=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._avatar()];case 1:return[2,null!==t.sent()]}}))}))},n.prototype.getHeaderText=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._header()];case 1:return[2,(t=e.sent())?t.text():null]}}))}))},n.prototype.getFooterText=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._footer()];case 1:return[2,(t=e.sent())?t.text():null]}}))}))},n.hostSelector=".mat-grid-tile",n}(r.ComponentHarness),o=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e._tileCoordinator=new n.ɵTileCoordinator,e}return e.__extends(o,t),o.with=function(t){return void 0===t&&(t={}),new r.HarnessPredicate(o,t)},o.prototype.getTiles=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this.locatorForAll(i.with(t))()];case 1:return[2,e.sent()]}}))}))},o.prototype.getColumns=function(){return e.__awaiter(this,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return t=Number,[4,this.host()];case 1:return[4,e.sent().getAttribute("cols")];case 2:return[2,t.apply(void 0,[e.sent()])]}}))}))},o.prototype.getTileAtPosition=function(t){var r=t.row,n=t.column;return e.__awaiter(this,void 0,void 0,(function(){var t,i,o,a,s,u,l,c,d,h;return e.__generator(this,(function(p){switch(p.label){case 0:return[4,Promise.all([this.getTiles(),this.getColumns()])];case 1:return t=e.__read.apply(void 0,[p.sent(),2]),o=t[1],a=(i=t[0]).map((function(t){return Promise.all([t.getColspan(),t.getRowspan()])})),[4,Promise.all(a)];case 2:for(s=p.sent().map((function(t){var r=e.__read(t,2);return{colspan:r[0],rowspan:r[1]}})),this._tileCoordinator.update(o,s),u=0;u<this._tileCoordinator.positions.length;u++)if(d=(c=s[u]).rowspan,h=c.colspan,n>=(l=this._tileCoordinator.positions[u]).col&&n<=l.col+h-1&&r>=l.row&&r<=l.row+d-1)return[2,i[u]];throw Error("Could not find tile at given position.")}}))}))},o.hostSelector=".mat-grid-list",o}(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.MatGridListHarness=o,t.MatGridTileHarness=i,Object.defineProperty(t,"__esModule",{value:!0})}));