@angular/material
Version:
Angular Material
38 lines (36 loc) • 8.34 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/testing"),require("@angular/material/form-field/testing/control"),require("@angular/material/core/testing")):"function"==typeof define&&define.amd?define("@angular/material/select/testing",["exports","@angular/cdk/testing","@angular/material/form-field/testing/control","@angular/material/core/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.select=t.ng.material.select||{},t.ng.material.select.testing={}),t.ng.cdk.testing,t.ng.material.formField.testing.control,t.ng.material.core.testing)}(this,(function(t,e,n,r){"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 o=function(t,e){return(o=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)},i=function(){return(i=Object.assign||function t(e){for(var n,r=1,o=arguments.length;r<o;r++)for(var i in n=arguments[r])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function s(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{a(r.next(t))}catch(t){i(t)}}function c(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(s,c)}a((r=r.apply(t,e||[])).next())}))}function c(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function a(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function a(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}
/**
* @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 u=".mat-select-panel",l=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e._documentRootLocator=e.documentRootLocatorFactory(),e._backdrop=e._documentRootLocator.locatorFor(".cdk-overlay-backdrop"),e._optionalPanel=e._documentRootLocator.locatorForOptional(u),e._trigger=e.locatorFor(".mat-select-trigger"),e._value=e.locatorFor(".mat-select-value"),e}return function l(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(n,t),n.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(n,t)},n.prototype.isDisabled=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-select-disabled")]}}))}))},n.prototype.isValid=function(){return s(this,void 0,void 0,(function(){return c(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()]}}))}))},n.prototype.isRequired=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-select-required")]}}))}))},n.prototype.isEmpty=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().hasClass("mat-select-empty")]}}))}))},n.prototype.isMultiple=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[4,t.sent().getAttribute("aria-multiselectable")];case 2:return[2,"true"===t.sent()]}}))}))},n.prototype.getValueText=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this._value()];case 1:return[2,t.sent().text()]}}))}))},n.prototype.focus=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().focus()]}}))}))},n.prototype.blur=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().blur()]}}))}))},n.prototype.getOptions=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this._documentRootLocator.locatorForAll(r.MatOptionHarness.with(i(i({},t),{ancestor:u})))()]}))}))},n.prototype.getOptionGroups=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this._documentRootLocator.locatorForAll(r.MatOptgroupHarness.with(i(i({},t),{ancestor:u})))()]}))}))},n.prototype.isOpen=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this._optionalPanel()];case 1:return[2,!!t.sent()]}}))}))},n.prototype.open=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.isOpen()];case 1:return t.sent()?[3,3]:[4,this._trigger()];case 2:return[2,t.sent().click()];case 3:return[2]}}))}))},n.prototype.clickOptions=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n,r;return c(this,(function(o){switch(o.label){case 0:return[4,this.open()];case 1:return o.sent(),[4,Promise.all([this.isMultiple(),this.getOptions(t)])];case 2:if(e=a.apply(void 0,[o.sent(),2]),n=e[0],0===(r=e[1]).length)throw Error("Select does not have options matching the specified filter");return n?[4,Promise.all(r.map((function(t){return t.click()})))]:[3,4];case 3:return o.sent(),[3,6];case 4:return[4,r[0].click()];case 5:o.sent(),o.label=6;case 6:return[2]}}))}))},n.prototype.close=function(){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return[4,this.isOpen()];case 1:return t.sent()?[4,this._backdrop()]:[3,3];case 2:return[2,t.sent().click()];case 3:return[2]}}))}))},n.hostSelector=".mat-select",n}(n.MatFormFieldControlHarness);
/**
* @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.MatSelectHarness=l,Object.defineProperty(t,"__esModule",{value:!0})}));