Skip to content

Instantly share code, notes, and snippets.

@evanwalsh
Created July 24, 2018 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanwalsh/1dcb64b7a86e3aed16cfeca692591444 to your computer and use it in GitHub Desktop.
Save evanwalsh/1dcb64b7a86e3aed16cfeca692591444 to your computer and use it in GitHub Desktop.
mithril-query.d.ts
declare var MithrilQuery: (...options: any[]) => MithrilQueryInstance
interface KeyEventOptions {
target?: any
value?: any
altKey?: boolean
shiftKey?: boolean
ctrlKey?: boolean
silent?: boolean
}
interface MithrilQueryInstance {
rootNode: any
redraw: () => void
first: (selector: string) => any
has: (selector: string) => boolean
contains: (value: string) => string
find: (selector: string) => any[]
setValue: (selector: string, value: string, silent?: boolean) => void
focus: (selector: string, event?: Event, silent?: boolean) => void
click: (selector: string, event?: Event, silent?: boolean) => void
blur: (selector: string, event: Event, silent?: boolean) => void
mousedown: (selector: string, event: Event, silent?: boolean) => void
mouseup: (selector: string, event: Event, silent?: boolean) => void
mouseover: (selector: string, event: Event, silent?: boolean) => void
mouseout: (selector: string, event: Event, silent?: boolean) => void
mouseenter: (selector: string, event: Event, silent?: boolean) => void
mouseleave: (selector: string, event: Event, silent?: boolean) => void
contextmenu: (selector: string, event: Event, silent?: boolean) => void
keydown: (selector: string, key: string, options: KeyEventOptions) => void
keypress: (selector: string, key: string, options: KeyEventOptions) => void
keyup: (selector: string, key: string, options: KeyEventOptions) => void
trigger: (selector: string, eventName: string, event: Event, silent?: boolean) => void
shouldHave: {
at: {
least: (minCount: number, selector: string) => boolean
}
}
should: {
not: {
have: (selector: string) => boolean
contain: (value: string) => boolean
}
have: {
(expectedCount: number, selector: string): boolean
at: {
least: (minCount: number, selector: string) => boolean
}
}
contain: (value: string) => boolean
}
}
declare module 'mithril-query' {
export = MithrilQuery
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment