blob: caad1558aee423e670fcc1762141e390a38316f4 [file] [log] [blame]
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/testing")):"function"==typeof define&&define.amd?define("@angular/material/stepper/testing",["exports","@angular/cdk/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.stepper=t.ng.material.stepper||{},t.ng.material.stepper.testing={}),t.ng.cdk.testing)}(this,(function(t,e){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function i(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{a(r.next(t))}catch(t){o(t)}}function u(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):function e(t){return t instanceof n?t:new n((function(e){e(t)}))}(t.value).then(s,u)}a((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,i,o,s={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 a(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}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])}}}var s=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.with=function(t){var r=this;return void 0===t&&(t={}),new e.HarnessPredicate(n,t).addOption("label",t.label,(function(t,n){return e.HarnessPredicate.stringMatches(t.getLabel(),n)})).addOption("selected",t.selected,(function(t,e){return i(r,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,t.isSelected()];case 1:return[2,n.sent()===e]}}))}))})).addOption("completed",t.completed,(function(t,e){return i(r,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,t.isCompleted()];case 1:return[2,n.sent()===e]}}))}))})).addOption("invalid",t.invalid,(function(t,e){return i(r,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,t.hasErrors()];case 1:return[2,n.sent()===e]}}))}))}))},n.prototype.getLabel=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.locatorFor(".mat-step-text-label")()];case 1:return[2,t.sent().text()]}}))}))},n.prototype.getAriaLabel=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[2,t.sent().getAttribute("aria-label")]}}))}))},n.prototype.getAriaLabelledby=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[2,t.sent().getAttribute("aria-labelledby")]}}))}))},n.prototype.isSelected=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().getAttribute("aria-selected")];case 2:return[2,"true"===t.sent()]}}))}))},n.prototype.isCompleted=function(){return i(this,void 0,void 0,(function(){var t,e,n;return o(this,(function(r){switch(r.label){case 0:return[4,this._getIconState()];case 1:return t=r.sent(),(e="done"===t)?[3,4]:(n="edit"===t)?[4,this.isSelected()]:[3,3];case 2:n=!r.sent(),r.label=3;case 3:e=n,r.label=4;case 4:return[2,e]}}))}))},n.prototype.hasErrors=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this._getIconState()];case 1:return[2,"error"===t.sent()]}}))}))},n.prototype.isOptional=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.locatorForOptional(".mat-step-optional")()];case 1:return[2,!!t.sent()]}}))}))},n.prototype.select=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().click()];case 2:return t.sent(),[2]}}))}))},n.prototype.getRootHarnessLoader=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return[4,this.host()];case 1:return[4,e.sent().getAttribute("aria-controls")];case 2:return t=e.sent(),[2,this.documentRootLocatorFactory().harnessLoaderFor("#"+t)]}}))}))},n.prototype._getIconState=function(){return i(this,void 0,void 0,(function(){var t,e;return o(this,(function(n){switch(n.label){case 0:return[4,this.locatorFor(".mat-step-icon")()];case 1:return[4,n.sent().getAttribute("class")];case 2:if(t=n.sent(),!(e=t.match(/mat-step-icon-state-([a-z]+)/)))throw Error('Could not determine step state from "'+t+'".');return[2,e[1]]}}))}))},n}(e.ContentContainerComponentHarness);s.hostSelector=".mat-step-header";var u=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.with=function(t){var r=this;return void 0===t&&(t={}),new e.HarnessPredicate(n,t).addOption("orientation",t.orientation,(function(t,e){return i(r,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,t.getOrientation()];case 1:return[2,n.sent()===e]}}))}))}))},n.prototype.getSteps=function(t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){return o(this,(function(e){return[2,this.locatorForAll(s.with(t))()]}))}))},n.prototype.getOrientation=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("mat-stepper-horizontal")];case 2:return[2,t.sent()?0:1]}}))}))},n.prototype.selectStep=function(t){return void 0===t&&(t={}),i(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return[4,this.getSteps(t)];case 1:if(!(e=n.sent()).length)throw Error("Cannot find mat-step matching filter "+JSON.stringify(t));return[4,e[0].select()];case 2:return n.sent(),[2]}}))}))},n}(e.ComponentHarness);u.hostSelector=".mat-stepper-horizontal, .mat-stepper-vertical";var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getText=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[2,t.sent().text()]}}))}))},e.prototype.click=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[2,t.sent().click()]}}))}))},e}(e.ComponentHarness),c=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(n,t).addOption("text",t.text,(function(t,n){return e.HarnessPredicate.stringMatches(t.getText(),n)}))},n}(a);c.hostSelector=".mat-stepper-next";var l=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(n,t).addOption("text",t.text,(function(t,n){return e.HarnessPredicate.stringMatches(t.getText(),n)}))},n}(a);l.hostSelector=".mat-stepper-previous",
/**
* @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.MatStepHarness=s,t.MatStepperHarness=u,t.MatStepperNextHarness=c,t.MatStepperPreviousHarness=l,Object.defineProperty(t,"__esModule",{value:!0})}));