UNPKG

@angular/material

Version:
22 lines 5.79 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("tslib"),require("@angular/cdk/coercion"),require("@angular/cdk/testing")):"function"==typeof define&&define.amd?define("@angular/material/checkbox/testing",["exports","tslib","@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.tslib,t.ng.cdk.coercion,t.ng.cdk.testing)}(this,(function(t,e,n,r){"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 i(){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 e.__extends(i,t),i.with=function(t){var n=this;return void 0===t&&(t={}),new r.HarnessPredicate(i,t).addOption("label",t.label,(function(t,e){return r.HarnessPredicate.stringMatches(t.getLabelText(),e)})).addOption("name",t.name,(function(t,r){return e.__awaiter(n,void 0,void 0,(function(){return e.__generator(this,(function(e){switch(e.label){case 0:return[4,t.getName()];case 1:return[2,e.sent()===r]}}))}))}))},i.prototype.isChecked=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,r;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this._input()];case 1:return t=e.sent().getProperty("checked"),r=n.coerceBooleanProperty,[4,t];case 2:return[2,r.apply(void 0,[e.sent()])]}}))}))},i.prototype.isIndeterminate=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,r;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this._input()];case 1:return t=e.sent().getProperty("indeterminate"),r=n.coerceBooleanProperty,[4,t];case 2:return[2,r.apply(void 0,[e.sent()])]}}))}))},i.prototype.isDisabled=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,r;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this._input()];case 1:return t=e.sent().getAttribute("disabled"),r=n.coerceBooleanProperty,[4,t];case 2:return[2,r.apply(void 0,[e.sent()])]}}))}))},i.prototype.isRequired=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,r;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this._input()];case 1:return t=e.sent().getProperty("required"),r=n.coerceBooleanProperty,[4,t];case 2:return[2,r.apply(void 0,[e.sent()])]}}))}))},i.prototype.isValid=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(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()]}}))}))},i.prototype.getName=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().getAttribute("name")]}}))}))},i.prototype.getValue=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().getProperty("value")]}}))}))},i.prototype.getAriaLabel=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().getAttribute("aria-label")]}}))}))},i.prototype.getAriaLabelledby=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().getAttribute("aria-labelledby")]}}))}))},i.prototype.getLabelText=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._label()];case 1:return[2,t.sent().text()]}}))}))},i.prototype.focus=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().focus()]}}))}))},i.prototype.blur=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._input()];case 1:return[2,t.sent().blur()]}}))}))},i.prototype.toggle=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(t){switch(t.label){case 0:return[4,this._inputContainer()];case 1:return[2,t.sent().click()]}}))}))},i.prototype.check=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(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]}}))}))},i.prototype.uncheck=function(){return e.__awaiter(this,void 0,void 0,(function(){return e.__generator(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]}}))}))},i.hostSelector="mat-checkbox",i}(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 */t.MatCheckboxHarness=i,Object.defineProperty(t,"__esModule",{value:!0})}));