blob: ba7d5a510c5e3ea1feabb9e7d883006d92caa1b4 [file] [log] [blame]
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/cdk/testing"),require("@angular/material/divider/testing")):"function"==typeof define&&define.amd?define("@angular/material/list/testing",["exports","@angular/cdk/testing","@angular/material/divider/testing"],e):e(((t=t||self).ng=t.ng||{},t.ng.material=t.ng.material||{},t.ng.material.list=t.ng.material.list||{},t.ng.material.list.testing={}),t.ng.cdk.testing,t.ng.material.divider.testing)}(this,(function(t,e,n){"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 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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function u(t){try{c(r.throw(t))}catch(t){o(t)}}function c(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)}c((r=r.apply(t,e||[])).next())}))}function s(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 c(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])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function a(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(c(arguments[e]));return t}function l(t,n){return new e.HarnessPredicate(t,n).addOption("text",n.text,(function(t,n){return e.HarnessPredicate.stringMatches(t.getText(),n)}))}var h=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return i(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.prototype.getText=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().text()]}}))}))},n}(e.ComponentHarness);h.hostSelector=".mat-subheader";var f=function(t){function n(){var e=t.apply(this,a(arguments))||this;return e._lines=e.locatorForAll(".mat-line"),e._avatar=e.locatorForOptional(".mat-list-avatar"),e._icon=e.locatorForOptional(".mat-list-icon"),e}return i(n,t),n.prototype.getText=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().text({exclude:".mat-list-icon, .mat-list-avatar"})]}}))}))},n.prototype.getLinesText=function(){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return[4,this._lines()];case 1:return t=n.sent(),[2,e.parallel((function(){return t.map((function(t){return t.text()}))}))]}}))}))},n.prototype.hasAvatar=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._avatar()];case 1:return[2,!!t.sent()]}}))}))},n.prototype.hasIcon=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._icon()];case 1:return[2,!!t.sent()]}}))}))},n.prototype.getHarnessLoaderForContent=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.getChildLoader(".mat-list-item-content")]}))}))},n}(e.ContentContainerComponentHarness),d=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return i(r,t),r.prototype.getItems=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this.locatorForAll(this._itemHarness.with(t))()]}))}))},r.prototype.getItemsGroupedBySubheader=function(t){return o(this,void 0,void 0,(function(){var n,r,i,c,a,l,f,d,p=this;return s(this,(function(v){switch(v.label){case 0:return n=[],r={items:[]},[4,this.getItemsWithSubheadersAndDividers({item:t,divider:!1})];case 1:i=v.sent();try{for(c=u(i),a=c.next();!a.done;a=c.next())(l=a.value)instanceof h?((void 0!==r.heading||r.items.length)&&n.push(r),r={heading:l.getText(),items:[]}):r.items.push(l)}catch(t){f={error:t}}finally{try{a&&!a.done&&(d=c.return)&&d.call(c)}finally{if(f)throw f.error}}return void 0===r.heading&&!r.items.length&&n.length||n.push(r),[2,e.parallel((function(){return n.map((function(t){return o(p,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return e={items:t.items},[4,t.heading];case 1:return[2,(e.heading=n.sent(),e)]}}))}))}))}))]}}))}))},r.prototype.getItemsGroupedByDividers=function(t){return o(this,void 0,void 0,(function(){var e,r,i,o,c,a,l;return s(this,(function(s){switch(s.label){case 0:return e=[[]],[4,this.getItemsWithSubheadersAndDividers({item:t,subheader:!1})];case 1:r=s.sent();try{for(i=u(r),o=i.next();!o.done;o=i.next())(c=o.value)instanceof n.MatDividerHarness?e.push([]):e[e.length-1].push(c)}catch(t){a={error:t}}finally{try{o&&!o.done&&(l=i.return)&&l.call(i)}finally{if(a)throw a.error}}return[2,e]}}))}))},r.prototype.getItemsWithSubheadersAndDividers=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var e;return s(this,(function(r){return e=[],!1!==t.item&&e.push(this._itemHarness.with(t.item||{})),!1!==t.subheader&&e.push(h.with(t.subheader)),!1!==t.divider&&e.push(n.MatDividerHarness.with(t.divider)),[2,this.locatorForAll.apply(this,a(e))()]}))}))},r}(e.ComponentHarness),p=function(t){function n(){var e=t.apply(this,a(arguments))||this;return e._itemHarness=v,e}return i(n,t),n.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(n,t)},n}(d);p.hostSelector="mat-action-list.mat-list";var v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.with=function(t){return void 0===t&&(t={}),l(e,t)},e.prototype.click=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().click()]}}))}))},e.prototype.focus=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().focus()]}}))}))},e.prototype.blur=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().blur()]}}))}))},e.prototype.isFocused=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().isFocused()]}}))}))},e}(f);v.hostSelector=p.hostSelector+" .mat-list-item";var y=function(t){function n(){var e=t.apply(this,a(arguments))||this;return e._itemHarness=m,e}return i(n,t),n.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(n,t)},n}(d);y.hostSelector=".mat-list:not(mat-action-list)";var m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.with=function(t){return void 0===t&&(t={}),l(e,t)},e}(f);m.hostSelector=y.hostSelector+" .mat-list-item";var b=function(t){function n(){var e=t.apply(this,a(arguments))||this;return e._itemHarness=g,e}return i(n,t),n.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(n,t)},n}(d);b.hostSelector=".mat-nav-list";var g=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return i(n,t),n.with=function(t){var r=this;return void 0===t&&(t={}),l(n,t).addOption("href",t.href,(function(t,n){return o(r,void 0,void 0,(function(){return s(this,(function(r){return[2,e.HarnessPredicate.stringMatches(t.getHref(),n)]}))}))}))},n.prototype.getHref=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().getAttribute("href")]}}))}))},n.prototype.click=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().click()]}}))}))},n.prototype.focus=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().focus()]}}))}))},n.prototype.blur=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().blur()]}}))}))},n.prototype.isFocused=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().isFocused()]}}))}))},n}(f);g.hostSelector=b.hostSelector+" .mat-list-item";var w=function(t){function n(){var e=t.apply(this,a(arguments))||this;return e._itemHarness=H,e}return i(n,t),n.with=function(t){return void 0===t&&(t={}),new e.HarnessPredicate(n,t)},n.prototype.isDisabled=function(){return o(this,void 0,void 0,(function(){return s(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()]}}))}))},n.prototype.selectItems=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return o(this,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return[4,this._getItems(t)];case 1:return n=r.sent(),[4,e.parallel((function(){return n.map((function(t){return t.select()}))}))];case 2:return r.sent(),[2]}}))}))},n.prototype.deselectItems=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return o(this,void 0,void 0,(function(){var n;return s(this,(function(r){switch(r.label){case 0:return[4,this._getItems(t)];case 1:return n=r.sent(),[4,e.parallel((function(){return n.map((function(t){return t.deselect()}))}))];case 2:return r.sent(),[2]}}))}))},n.prototype._getItems=function(t){return o(this,void 0,void 0,(function(){var n=this;return s(this,(function(r){switch(r.label){case 0:return t.length?[4,e.parallel((function(){return t.map((function(t){return n.locatorForAll(H.with(t))()}))}))]:[2,this.getItems()];case 1:return[2,r.sent().reduce((function(t,e){return a(t,e)}),[])]}}))}))},n}(d);w.hostSelector=".mat-selection-list";var H=function(t){function e(){var e=t.apply(this,a(arguments))||this;return e._itemContent=e.locatorFor(".mat-list-item-content"),e}return i(e,t),e.with=function(t){var n=this;return void 0===t&&(t={}),l(e,t).addOption("is selected",t.selected,(function(t,e){return o(n,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,t.isSelected()];case 1:return[2,n.sent()===e]}}))}))}))},e.prototype.getCheckboxPosition=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._itemContent()];case 1:return[4,t.sent().hasClass("mat-list-item-content-reverse")];case 2:return[2,t.sent()?"after":"before"]}}))}))},e.prototype.isSelected=function(){return o(this,void 0,void 0,(function(){return s(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()]}}))}))},e.prototype.isDisabled=function(){return o(this,void 0,void 0,(function(){return s(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()]}}))}))},e.prototype.focus=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().focus()]}}))}))},e.prototype.blur=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().blur()]}}))}))},e.prototype.isFocused=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().isFocused()]}}))}))},e.prototype.toggle=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.host()];case 1:return[2,t.sent().click()]}}))}))},e.prototype.select=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.isSelected()];case 1:return t.sent()?[2]:[2,this.toggle()]}}))}))},e.prototype.deselect=function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.isSelected()];case 1:return t.sent()?[2,this.toggle()]:[2]}}))}))},e}(f);H.hostSelector=".mat-list-option",
/**
* @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.MatActionListHarness=p,t.MatActionListItemHarness=v,t.MatListHarness=y,t.MatListItemHarness=m,t.MatListOptionHarness=H,t.MatNavListHarness=b,t.MatNavListItemHarness=g,t.MatSelectionListHarness=w,Object.defineProperty(t,"__esModule",{value:!0})}));