Skip to content

Commit 492f4f4

Browse files
authored
Type FunctionPlotOptions.target missing HTMLElement and Github Actions build workflow (#190)
Makes options.target a union of string | HTMLElement, move to Github Actions
1 parent 1beb17d commit 492f4f4

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, reopened, synchronize]
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/[email protected]
14+
15+
- name: Install dependencies
16+
run: npm install
17+
18+
- name: Test
19+
run: npm run test
20+
21+
- name: Build
22+
run: npm run build
23+
24+
- name: Publish to Chromatic
25+
if: github.event_name != 'pull_request'
26+
uses: chromaui/action@v1
27+
with:
28+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
29+
30+
- name: Run Fossa and upload data
31+
uses: fossa-contrib/fossa-action@v1
32+
with:
33+
fossa-api-key: abcdefghijklmnopqrstuvwxyz

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export class Chart extends EventEmitter.EventEmitter {
153153
}
154154

155155
private getDraggableNode() {
156-
return d3Select(this.options.target).select('.zoom-and-drag').node()
156+
return d3Select(this.options.target as any).select('.zoom-and-drag').node()
157157
}
158158

159159
/**
@@ -271,7 +271,7 @@ export class Chart extends EventEmitter.EventEmitter {
271271
}
272272

273273
drawGraphWrapper () {
274-
const root = this.root = d3Select(this.options.target)
274+
const root = this.root = d3Select(this.options.target as any)
275275
.selectAll('svg')
276276
.data([this.options])
277277

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export interface FunctionPlotOptions {
278278
/**
279279
* A css selector or DOM node of the parent element that will contain the graph
280280
*/
281-
target: string
281+
target: string | HTMLElement
282282

283283
/**
284284
* The chart title

0 commit comments

Comments
 (0)