* Pop items off of the stack up to and including `lastItem` and emit each on the close * observable. If the stack is empty or `lastItem` is not on the stack it does nothing. * @param lastItem the last item to pop off the stack. * @param options Options that configure behavior on close.
(lastItem: MenuStackItem, options?: CloseOptions)
| 126 | * @param options Options that configure behavior on close. |
| 127 | */ |
| 128 | close(lastItem: MenuStackItem, options?: CloseOptions) { |
| 129 | const {focusNextOnEmpty, focusParentTrigger} = {...options}; |
| 130 | if (this._elements.indexOf(lastItem) >= 0) { |
| 131 | let poppedElement; |
| 132 | do { |
| 133 | poppedElement = this._elements.pop()!; |
| 134 | this._close.next({item: poppedElement, focusParentTrigger}); |
| 135 | } while (poppedElement !== lastItem); |
| 136 | |
| 137 | if (this.isEmpty()) { |
| 138 | this._empty.next(focusNextOnEmpty); |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Pop items off of the stack up to but excluding `lastItem` and emit each on the close |
no test coverage detected