@angular/material
Version:
Angular Material
45 lines (43 loc) • 7.94 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/testing"),require("@angular/material/grid-list")):"function"==typeof define&&define.amd?define("@angular/material/grid-list/testing",["exports","@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.ng.cdk.testing,t.ng.material.gridList)}(this,(function(t,e,r){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function o(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function i(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(a,s)}u((n=n.apply(t,e||[])).next())}))}function a(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function u(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function s(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}
/**
* @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 u=function(t){function r(){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 o(r,t),r.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(r,t).addOption("headerText",t.headerText,(function(t,r){return e.HarnessPredicate.stringMatches(t.getHeaderText(),r)})).addOption("footerText",t.footerText,(function(t,r){return e.HarnessPredicate.stringMatches(t.getFooterText(),r)}))},r.prototype.getRowspan=function(){return i(this,void 0,void 0,(function(){var t;return a(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()])]}}))}))},r.prototype.getColspan=function(){return i(this,void 0,void 0,(function(){var t;return a(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()])]}}))}))},r.prototype.hasHeader=function(){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this._header()];case 1:return[2,null!==t.sent()]}}))}))},r.prototype.hasFooter=function(){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this._footer()];case 1:return[2,null!==t.sent()]}}))}))},r.prototype.hasAvatar=function(){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this._avatar()];case 1:return[2,null!==t.sent()]}}))}))},r.prototype.getHeaderText=function(){return i(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return[4,this._header()];case 1:return[2,(t=e.sent())?t.text():null]}}))}))},r.prototype.getFooterText=function(){return i(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return[4,this._footer()];case 1:return[2,(t=e.sent())?t.text():null]}}))}))},r.hostSelector=".mat-grid-tile",r}(e.ComponentHarness),l=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e._tileCoordinator=new r.ɵTileCoordinator,e}return o(n,t),n.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(n,t)},n.prototype.getTiles=function(t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.locatorForAll(u.with(t))()];case 1:return[2,e.sent()]}}))}))},n.prototype.getColumns=function(){return i(this,void 0,void 0,(function(){var t;return a(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()])]}}))}))},n.prototype.getTileAtPosition=function(t){var e=t.row,r=t.column;return i(this,void 0,void 0,(function(){var t,n,o,i,u,l,c,f,p,h;return a(this,(function(a){switch(a.label){case 0:return[4,Promise.all([this.getTiles(),this.getColumns()])];case 1:return t=s.apply(void 0,[a.sent(),2]),o=t[1],i=(n=t[0]).map((function(t){return Promise.all([t.getColspan(),t.getRowspan()])})),[4,Promise.all(i)];case 2:for(u=a.sent().map((function(t){var e=s(t,2);return{colspan:e[0],rowspan:e[1]}})),this._tileCoordinator.update(o,u),l=0;l<this._tileCoordinator.positions.length;l++)if(p=(f=u[l]).rowspan,h=f.colspan,r>=(c=this._tileCoordinator.positions[l]).col&&r<=c.col+h-1&&e>=c.row&&e<=c.row+p-1)return[2,n[l]];throw Error("Could not find tile at given position.")}}))}))},n.hostSelector=".mat-grid-list",n}(e.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=l,t.MatGridTileHarness=u,Object.defineProperty(t,"__esModule",{value:!0})}));