UNPKG

@angular/material

Version:
37 lines (35 loc) 7.89 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/coercion"),require("@angular/cdk/testing")):"function"==typeof define&&define.amd?define("@angular/material/checkbox/testing",["exports","@angular/cdk/coercion","@angular/cdk/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.checkbox=t.ng.material.checkbox||{},t.ng.material.checkbox.testing={}),t.ng.cdk.coercion,t.ng.cdk.testing)}(this,(function(t,e,n){"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 r=function(t,e){return(r=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 i(t,e,n,r){return new(n||(n=Promise))((function(i,o){function c(t){try{s(r.next(t))}catch(t){o(t)}}function u(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(c,u)}s((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,i,o,c={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function s(o){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!(i=(i=c.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){c=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){c.label=o[1];break}if(6===o[0]&&c.label<i[1]){c.label=i[1],i=o;break}if(i&&c.label<i[2]){c.label=i[2],c.ops.push(o);break}i[2]&&c.ops.pop(),c.trys.pop();continue}o=e.call(t,c)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}} /** * @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 c=function(t){function c(){var e=null!==t&&t.apply(this,arguments)||this;return e._label=e.locatorFor(".mat-checkbox-label"),e._input=e.locatorFor("input"),e._inputContainer=e.locatorFor(".mat-checkbox-inner-container"),e}return function u(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(c,t),c.with=function(t){var e=this;return void 0===t&&(t={}),new n.HarnessPredicate(c,t).addOption("label",t.label,(function(t,e){return n.HarnessPredicate.stringMatches(t.getLabelText(),e)})).addOption("name",t.name,(function(t,n){return i(e,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,t.getName()];case 1:return[2,e.sent()===n]}}))}))}))},c.prototype.isChecked=function(){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return[4,this._input()];case 1:return t=r.sent().getProperty("checked"),n=e.coerceBooleanProperty,[4,t];case 2:return[2,n.apply(void 0,[r.sent()])]}}))}))},c.prototype.isIndeterminate=function(){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return[4,this._input()];case 1:return t=r.sent().getProperty("indeterminate"),n=e.coerceBooleanProperty,[4,t];case 2:return[2,n.apply(void 0,[r.sent()])]}}))}))},c.prototype.isDisabled=function(){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return[4,this._input()];case 1:return t=r.sent().getAttribute("disabled"),n=e.coerceBooleanProperty,[4,t];case 2:return[2,n.apply(void 0,[r.sent()])]}}))}))},c.prototype.isRequired=function(){return i(this,void 0,void 0,(function(){var t,n;return o(this,(function(r){switch(r.label){case 0:return[4,this._input()];case 1:return t=r.sent().getProperty("required"),n=e.coerceBooleanProperty,[4,t];case 2:return[2,n.apply(void 0,[r.sent()])]}}))}))},c.prototype.isValid=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[4,t.sent().hasClass("ng-invalid")];case 2:return[2,!t.sent()]}}))}))},c.prototype.getName=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().getAttribute("name")]}}))}))},c.prototype.getValue=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().getProperty("value")]}}))}))},c.prototype.getAriaLabel=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().getAttribute("aria-label")]}}))}))},c.prototype.getAriaLabelledby=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().getAttribute("aria-labelledby")]}}))}))},c.prototype.getLabelText=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._label()];case 1:return[2,t.sent().text()]}}))}))},c.prototype.focus=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().focus()]}}))}))},c.prototype.blur=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().blur()]}}))}))},c.prototype.toggle=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._inputContainer()];case 1:return[2,t.sent().click()]}}))}))},c.prototype.check=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.isChecked()];case 1:return t.sent()?[3,3]:[4,this.toggle()];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},c.prototype.uncheck=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.isChecked()];case 1:return t.sent()?[4,this.toggle()]:[3,3];case 2:t.sent(),t.label=3;case 3:return[2]}}))}))},c.hostSelector="mat-checkbox",c}(n.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.MatCheckboxHarness=c,Object.defineProperty(t,"__esModule",{value:!0})}));