Skip to content

Commit

Permalink
Add setValue() method to sidebar input binding (needed for shinytest …
Browse files Browse the repository at this point in the history
…to set it's value) (#495)
  • Loading branch information
cpsievert committed Mar 6, 2023
1 parent 6b7bbc1 commit 5f90b6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion inst/components/sidebar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions inst/components/sidebar.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions srcts/src/components/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class SidebarInputBinding extends InputBinding {
return !$(el).parent().hasClass(COLLAPSE_CLASS);
}

setValue(el: HTMLElement, value: boolean): void {
const method = value ? "open" : "close";
this.receiveMessage(el, { method });
}

subscribe(el: HTMLElement, callback: (x: boolean) => void) {
$(el).on(
"toggleCollapse.sidebarInputBinding",
Expand Down

0 comments on commit 5f90b6e

Please sign in to comment.