UNPKG

@angular/material

Version:
37 lines (35 loc) 5.8 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/testing")):"function"==typeof define&&define.amd?define("@angular/material/badge/testing",["exports","@angular/cdk/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.badge=t.ng.material.badge||{},t.ng.material.badge.testing={}),t.ng.cdk.testing)}(this,(function(t,e){"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 n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e,n,r){return new(n||(n=Promise))((function(a,s){function o(t){try{u(r.next(t))}catch(t){s(t)}}function i(t){try{u(r.throw(t))}catch(t){s(t)}}function u(t){t.done?a(t.value):new n((function(e){e(t.value)})).then(o,i)}u((r=r.apply(t,e||[])).next())}))}function a(t,e){var n,r,a,s,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(s){return function(i){return function u(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){o.label=s[1];break}if(6===s[0]&&o.label<a[1]){o.label=a[1],a=s;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}} /** * @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._badgeElement=e.locatorFor(".mat-badge-content"),e}return 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)}(s,t),s.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(s,t).addOption("text",t.text,(function(t,n){return e.HarnessPredicate.stringMatches(t.getText(),n)}))},s.prototype.getText=function(){return r(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this._badgeElement()];case 1:return[2,t.sent().text()]}}))}))},s.prototype.isOverlapping=function(){return r(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-badge-overlap")]}}))}))},s.prototype.getPosition=function(){return r(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return[4,this.host()];case 1:return t=n.sent(),e="",[4,t.hasClass("mat-badge-above")];case 2:return n.sent()?(e+="above",[3,5]):[3,3];case 3:return[4,t.hasClass("mat-badge-below")];case 4:n.sent()&&(e+="below"),n.label=5;case 5:return[4,t.hasClass("mat-badge-before")];case 6:return n.sent()?(e+=" before",[3,9]):[3,7];case 7:return[4,t.hasClass("mat-badge-after")];case 8:n.sent()&&(e+=" after"),n.label=9;case 9:return[2,e.trim()]}}))}))},s.prototype.getSize=function(){return r(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return[4,this.host()];case 1:return[4,(t=e.sent()).hasClass("mat-badge-small")];case 2:return e.sent()?[2,"small"]:[3,3];case 3:return[4,t.hasClass("mat-badge-large")];case 4:if(e.sent())return[2,"large"];e.label=5;case 5:return[2,"medium"]}}))}))},s.prototype.isHidden=function(){return r(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-badge-hidden")]}}))}))},s.prototype.isDisabled=function(){return r(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-badge-disabled")]}}))}))},s.hostSelector=".mat-badge",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.MatBadgeHarness=s,Object.defineProperty(t,"__esModule",{value:!0})}));