UNPKG

@angular/material

Version:
38 lines (36 loc) 6.74 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/coercion"),require("@angular/cdk/testing"),require("@angular/material/core/testing")):"function"==typeof define&&define.amd?define("@angular/material/autocomplete/testing",["exports","@angular/cdk/coercion","@angular/cdk/testing","@angular/material/core/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.autocomplete=t.ng.material.autocomplete||{},t.ng.material.autocomplete.testing={}),t.ng.cdk.coercion,t.ng.cdk.testing,t.ng.material.core.testing)}(this,(function(t,e,n,o){"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)},i=function(){return(i=Object.assign||function t(e){for(var n,o=1,r=arguments.length;o<r;o++)for(var i in n=arguments[o])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function a(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){t.done?r(t.value):new n((function(e){e(t.value)})).then(a,u)}c((o=o.apply(t,e||[])).next())}))}function u(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function c(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,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=".mat-autocomplete-panel",s=function(t){function s(){var e=null!==t&&t.apply(this,arguments)||this;return e._documentRootLocator=e.documentRootLocatorFactory(),e._optionalPanel=e._documentRootLocator.locatorForOptional(c),e}return function l(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(s,t),s.with=function(t){return void 0===t&&(t={}),new n.HarnessPredicate(s,t).addOption("value",t.value,(function(t,e){return n.HarnessPredicate.stringMatches(t.getValue(),e)}))},s.prototype.getValue=function(){return a(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().getProperty("value")]}}))}))},s.prototype.isDisabled=function(){return a(this,void 0,void 0,(function(){var t,n;return u(this,(function(o){switch(o.label){case 0:return[4,this.host()];case 1:return t=o.sent().getAttribute("disabled"),n=e.coerceBooleanProperty,[4,t];case 2:return[2,n.apply(void 0,[o.sent()])]}}))}))},s.prototype.focus=function(){return a(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().focus()]}}))}))},s.prototype.blur=function(){return a(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().blur()]}}))}))},s.prototype.enterText=function(t){return a(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.host()];case 1:return[2,e.sent().sendKeys(t)]}}))}))},s.prototype.getOptions=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){return u(this,(function(e){return[2,this._documentRootLocator.locatorForAll(o.MatOptionHarness.with(i(i({},t),{ancestor:c})))()]}))}))},s.prototype.getOptionGroups=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){return u(this,(function(e){return[2,this._documentRootLocator.locatorForAll(o.MatOptgroupHarness.with(i(i({},t),{ancestor:c})))()]}))}))},s.prototype.selectOption=function(t){return a(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return[4,this.focus()];case 1:return n.sent(),[4,this.getOptions(t)];case 2:if(!(e=n.sent()).length)throw Error("Could not find a mat-option matching "+JSON.stringify(t));return[4,e[0].click()];case 3:return n.sent(),[2]}}))}))},s.prototype.isOpen=function(){return a(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return[4,this._optionalPanel()];case 1:return t=n.sent(),(e=!!t)?[4,t.hasClass("mat-autocomplete-visible")]:[3,3];case 2:e=n.sent(),n.label=3;case 3:return[2,e]}}))}))},s.hostSelector=".mat-autocomplete-trigger",s}(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.MatAutocompleteHarness=s,Object.defineProperty(t,"__esModule",{value:!0})}));