@angular/material
Version:
Angular Material
30 lines • 6.59 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("tslib"),require("@angular/cdk/testing"),require("@angular/cdk/coercion")):"function"==typeof define&&define.amd?define("@angular/material/button-toggle/testing",["exports","tslib","@angular/cdk/testing","@angular/cdk/coercion"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.buttonToggle=t.ng.material.buttonToggle||{},t.ng.material.buttonToggle.testing={}),t.tslib,t.ng.cdk.testing,t.ng.cdk.coercion)}(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-button-toggle-label-content"),e._button=e.locatorFor(".mat-button-toggle-button"),e}return e.__extends(i,t),i.with=function(t){var r=this;return void 0===t&&(t={}),new n.HarnessPredicate(i,t).addOption("text",t.text,(function(t,e){return n.HarnessPredicate.stringMatches(t.getText(),e)})).addOption("name",t.name,(function(t,e){return n.HarnessPredicate.stringMatches(t.getName(),e)})).addOption("checked",t.checked,(function(t,n){return e.__awaiter(r,void 0,void 0,(function(){return e.__generator(this,(function(e){switch(e.label){case 0:return[4,t.isChecked()];case 1:return[2,e.sent()===n]}}))}))}))},i.prototype.isChecked=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this._button()];case 1:return t=e.sent().getAttribute("aria-pressed"),n=r.coerceBooleanProperty,[4,t];case 2:return[2,n.apply(void 0,[e.sent()])]}}))}))},i.prototype.isDisabled=function(){return e.__awaiter(this,void 0,void 0,(function(){var t,n;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,this._button()];case 1:return t=e.sent().getAttribute("disabled"),n=r.coerceBooleanProperty,[4,t];case 2:return[2,n.apply(void 0,[e.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._button()];case 1:return[2,t.sent().getAttribute("name")]}}))}))},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._button()];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._button()];case 1:return[2,t.sent().getAttribute("aria-labelledby")]}}))}))},i.prototype.getText=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.getAppearance=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("mat-button-toggle-appearance-standard")];case 2:return[2,t.sent()?"standard":"legacy"]}}))}))},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._button()];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._button()];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._button()];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-button-toggle",i}(n.ComponentHarness),o=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return e.__extends(r,t),r.with=function(t){return void 0===t&&(t={}),new n.HarnessPredicate(r,t)},r.prototype.getToggles=function(t){return void 0===t&&(t={}),e.__awaiter(this,void 0,void 0,(function(){return e.__generator(this,(function(e){return[2,this.locatorForAll(i.with(t))()]}))}))},r.prototype.isDisabled=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().getAttribute("aria-disabled")];case 2:return[2,"true"===t.sent()]}}))}))},r.prototype.isVertical=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[2,t.sent().hasClass("mat-button-toggle-vertical")]}}))}))},r.prototype.getAppearance=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("mat-button-toggle-group-appearance-standard")];case 2:return[2,t.sent()?"standard":"legacy"]}}))}))},r.hostSelector="mat-button-toggle-group",r}(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
*/
/**
* @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.MatButtonToggleGroupHarness=o,t.MatButtonToggleHarness=i,Object.defineProperty(t,"__esModule",{value:!0})}));