-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollapsible.ts
31 lines (26 loc) · 990 Bytes
/
collapsible.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import {BaseComponent} from '../baseComponent';
export class Collapsible extends BaseComponent {
static defaultSelector = '.moonstone-collapsible'
collapse(): Collapsible {
this.get().children('div').then($child => {
if ($child.hasClass('moonstone-collapsible_content_expanded')) {
this.get().find('.moonstone-collapsible_button').click();
}
});
return this;
}
expand(): Collapsible {
this.get().children('div').then($child => {
if ($child.hasClass('moonstone-collapsible_content_collapsed')) {
this.get().find('.moonstone-collapsible_button').click().scrollIntoView();
}
});
return this;
}
shouldBeCollapsed(): void {
this.get().find('.moonstone-collapsible_content_collapsed').should('exist');
}
shouldBeExpanded(): void {
this.get().find('.moonstone-collapsible_content_expanded').should('exist');
}
}