@angular/material
Version:
Angular Material
37 lines (35 loc) • 6.59 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/testing"),require("@angular/material/select/testing"),require("@angular/cdk/coercion")):"function"==typeof define&&define.amd?define("@angular/material/paginator/testing",["exports","@angular/cdk/testing","@angular/material/select/testing","@angular/cdk/coercion"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.paginator=t.ng.material.paginator||{},t.ng.material.paginator.testing={}),t.ng.cdk.testing,t.ng.material.select.testing,t.ng.cdk.coercion)}(this,(function(t,e,n,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 o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function a(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function s(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(i,s)}u((r=r.apply(t,e||[])).next())}))}function i(t,e){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function u(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}
/**
* @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 s=function(t){function s(){var e=null!==t&&t.apply(this,arguments)||this;return e._nextButton=e.locatorFor(".mat-paginator-navigation-next"),e._previousButton=e.locatorFor(".mat-paginator-navigation-previous"),e._firstPageButton=e.locatorForOptional(".mat-paginator-navigation-first"),e._lastPageButton=e.locatorForOptional(".mat-paginator-navigation-last"),e._select=e.locatorForOptional(n.MatSelectHarness.with({ancestor:".mat-paginator-page-size"})),e._pageSizeFallback=e.locatorFor(".mat-paginator-page-size-value"),e._rangeLabel=e.locatorFor(".mat-paginator-range-label"),e}return function u(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(s,t),s.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(s,t)},s.prototype.goToNextPage=function(){return a(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this._nextButton()];case 1:return[2,t.sent().click()]}}))}))},s.prototype.goToPreviousPage=function(){return a(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this._previousButton()];case 1:return[2,t.sent().click()]}}))}))},s.prototype.goToFirstPage=function(){return a(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this._firstPageButton()];case 1:if(!(t=e.sent()))throw Error("Could not find first page button inside paginator. Make sure that `showFirstLastButtons` is enabled.");return[2,t.click()]}}))}))},s.prototype.goToLastPage=function(){return a(this,void 0,void 0,(function(){var t;return i(this,(function(e){switch(e.label){case 0:return[4,this._lastPageButton()];case 1:if(!(t=e.sent()))throw Error("Could not find last page button inside paginator. Make sure that `showFirstLastButtons` is enabled.");return[2,t.click()]}}))}))},s.prototype.setPageSize=function(t){return a(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._select()];case 1:if(!(e=n.sent()))throw Error("Cannot find page size selector in paginator. Make sure that the `pageSizeOptions` have been configured.");return[2,e.clickOptions({text:""+t})]}}))}))},s.prototype.getPageSize=function(){return a(this,void 0,void 0,(function(){var t,e,n;return i(this,(function(o){switch(o.label){case 0:return[4,this._select()];case 1:return(t=o.sent())?(e=t.getValueText(),[3,4]):[3,2];case 2:return[4,this._pageSizeFallback()];case 3:e=o.sent().text(),o.label=4;case 4:return n=r.coerceNumberProperty,[4,e];case 5:return[2,n.apply(void 0,[o.sent()])]}}))}))},s.prototype.getRangeLabel=function(){return a(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this._rangeLabel()];case 1:return[2,t.sent().text()]}}))}))},s.hostSelector=".mat-paginator",s}(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
*/t.MatPaginatorHarness=s,Object.defineProperty(t,"__esModule",{value:!0})}));