@jbrowse/plugin-data-management 2.3.2 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/AddConnectionWidget/index.d.ts +3 -2
  2. package/dist/AddConnectionWidget/index.js +38 -4
  3. package/dist/AddConnectionWidget/index.js.map +1 -1
  4. package/dist/AddTrackWidget/index.d.ts +3 -2
  5. package/dist/AddTrackWidget/index.js +38 -4
  6. package/dist/AddTrackWidget/index.js.map +1 -1
  7. package/dist/HierarchicalTrackSelectorWidget/index.d.ts +3 -0
  8. package/dist/HierarchicalTrackSelectorWidget/index.js +36 -0
  9. package/dist/HierarchicalTrackSelectorWidget/index.js.map +1 -1
  10. package/dist/PluginStoreWidget/index.d.ts +3 -2
  11. package/dist/PluginStoreWidget/index.js +38 -4
  12. package/dist/PluginStoreWidget/index.js.map +1 -1
  13. package/dist/index.js +10 -51
  14. package/dist/index.js.map +1 -1
  15. package/dist/ucsc-trackhub/index.d.ts +3 -2
  16. package/dist/ucsc-trackhub/index.js +13 -5
  17. package/dist/ucsc-trackhub/index.js.map +1 -1
  18. package/esm/AddConnectionWidget/index.d.ts +3 -2
  19. package/esm/AddConnectionWidget/index.js +15 -2
  20. package/esm/AddConnectionWidget/index.js.map +1 -1
  21. package/esm/AddTrackWidget/index.d.ts +3 -2
  22. package/esm/AddTrackWidget/index.js +15 -2
  23. package/esm/AddTrackWidget/index.js.map +1 -1
  24. package/esm/HierarchicalTrackSelectorWidget/index.d.ts +3 -0
  25. package/esm/HierarchicalTrackSelectorWidget/index.js +13 -0
  26. package/esm/HierarchicalTrackSelectorWidget/index.js.map +1 -1
  27. package/esm/PluginStoreWidget/index.d.ts +3 -2
  28. package/esm/PluginStoreWidget/index.js +15 -2
  29. package/esm/PluginStoreWidget/index.js.map +1 -1
  30. package/esm/index.js +10 -51
  31. package/esm/index.js.map +1 -1
  32. package/esm/ucsc-trackhub/index.d.ts +3 -2
  33. package/esm/ucsc-trackhub/index.js +13 -2
  34. package/esm/ucsc-trackhub/index.js.map +1 -1
  35. package/package.json +2 -2
  36. package/src/AddConnectionWidget/components/{AddConnectionWidget.test.js → AddConnectionWidget.test.tsx} +17 -8
  37. package/src/AddConnectionWidget/components/__snapshots__/{AddConnectionWidget.test.js.snap → AddConnectionWidget.test.tsx.snap} +0 -0
  38. package/src/AddConnectionWidget/index.ts +17 -2
  39. package/src/AddTrackWidget/{index.test.jsx → index.test.tsx} +34 -37
  40. package/src/AddTrackWidget/index.ts +17 -2
  41. package/src/HierarchicalTrackSelectorWidget/components/HierarchicalTrackSelector.test.tsx +124 -128
  42. package/src/HierarchicalTrackSelectorWidget/components/__snapshots__/HierarchicalTrackSelector.test.tsx.snap +5 -5
  43. package/src/HierarchicalTrackSelectorWidget/index.ts +17 -0
  44. package/src/PluginStoreWidget/components/PluginStoreWidget.test.tsx +132 -0
  45. package/src/PluginStoreWidget/components/__snapshots__/{PluginStoreWidget.test.js.snap → PluginStoreWidget.test.tsx.snap} +2 -2
  46. package/src/PluginStoreWidget/index.ts +17 -2
  47. package/src/PluginStoreWidget/{model.test.js → model.test.tsx} +0 -0
  48. package/src/__snapshots__/index.test.ts.snap +9 -0
  49. package/src/index.test.ts +54 -0
  50. package/src/index.ts +10 -83
  51. package/src/ucsc-trackhub/index.ts +19 -2
  52. package/src/PluginStoreWidget/components/PluginStoreWidget.test.js +0 -123
  53. package/src/__snapshots__/index.test.js.snap +0 -9
  54. package/src/index.test.js +0 -61
@@ -1,3 +1,14 @@
1
- export { default as modelFactory } from './model';
2
- export { default as configSchema } from './configSchema';
1
+ import { ConnectionType } from '@jbrowse/core/pluggableElementTypes';
2
+ import stateModelFactory from './model';
3
+ import configSchema from './configSchema';
4
+ export default (pluginManager) => {
5
+ pluginManager.addConnectionType(() => new ConnectionType({
6
+ name: 'UCSCTrackHubConnection',
7
+ configSchema,
8
+ stateModel: stateModelFactory(pluginManager),
9
+ displayName: 'UCSC Track Hub',
10
+ description: 'A track or assembly hub in the Track Hub format',
11
+ url: '//genome.ucsc.edu/goldenPath/help/hgTrackHubHelp.html#Intro',
12
+ }));
13
+ };
3
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ucsc-trackhub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ucsc-trackhub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAGpE,OAAO,iBAAiB,MAAM,SAAS,CAAA;AACvC,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAEzC,eAAe,CAAC,aAA4B,EAAE,EAAE;IAC9C,aAAa,CAAC,iBAAiB,CAC7B,GAAG,EAAE,CACH,IAAI,cAAc,CAAC;QACjB,IAAI,EAAE,wBAAwB;QAC9B,YAAY;QACZ,UAAU,EAAE,iBAAiB,CAAC,aAAa,CAAC;QAC5C,WAAW,EAAE,gBAAgB;QAC7B,WAAW,EAAE,iDAAiD;QAC9D,GAAG,EAAE,6DAA6D;KACnE,CAAC,CACL,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-data-management",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "JBrowse 2 linear genome view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -60,5 +60,5 @@
60
60
  "distModule": "esm/index.js",
61
61
  "srcModule": "src/index.ts",
62
62
  "module": "esm/index.js",
63
- "gitHead": "467d973535bb7b2664e9f66311fb0dc21c1ce5ba"
63
+ "gitHead": "283e0387ccd5acc9f092cf00804d1fcac212e68d"
64
64
  }
@@ -1,14 +1,18 @@
1
- import { render, cleanup, fireEvent } from '@testing-library/react'
2
1
  import React from 'react'
2
+ import { render, cleanup, fireEvent } from '@testing-library/react'
3
3
  import { createTestSession } from '@jbrowse/web/src/rootModel'
4
+
5
+ // locals
4
6
  import AddConnectionWidget from './AddConnectionWidget'
7
+
5
8
  jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
6
9
 
7
- window.fetch = jest.fn(() => new Promise(resolve => resolve()))
10
+ // window.fetch = jest.fn(() => new Promise(resolve => resolve()))
8
11
 
9
12
  describe('<AddConnectionWidget />', () => {
10
- let model
11
- let session
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ let model: any
15
+ let session: ReturnType<typeof createTestSession>
12
16
 
13
17
  beforeEach(() => {
14
18
  session = createTestSession()
@@ -42,7 +46,8 @@ describe('<AddConnectionWidget />', () => {
42
46
  })
43
47
 
44
48
  it('can handle a custom UCSC trackHub URL', async () => {
45
- const mockFetch = url => {
49
+ const mockFetch = async (url: RequestInfo | URL) => {
50
+ // @ts-ignore
46
51
  const urlText = url.href ? url.href : url
47
52
  let responseText = ''
48
53
  if (urlText.endsWith('hub.txt')) {
@@ -66,9 +71,11 @@ type bigWig
66
71
  `
67
72
  }
68
73
 
69
- return Promise.resolve(new Response(responseText, { url: urlText }))
74
+ return new Response(responseText)
70
75
  }
76
+
71
77
  jest.spyOn(global, 'fetch').mockImplementation(mockFetch)
78
+
72
79
  const { findByTestId, getAllByRole, findAllByText, findByDisplayValue } =
73
80
  render(<AddConnectionWidget model={model} />)
74
81
  expect(session.connections.length).toBe(0)
@@ -90,7 +97,8 @@ type bigWig
90
97
  })
91
98
 
92
99
  it('can handle a custom JBrowse 1 data directory URL', async () => {
93
- const mockFetch = url => {
100
+ const mockFetch = async (url: RequestInfo | URL) => {
101
+ // @ts-ignore
94
102
  const urlText = url.href ? url.href : url
95
103
  let responseText = ''
96
104
  if (urlText.endsWith('trackList.json')) {
@@ -98,9 +106,10 @@ type bigWig
98
106
  } else if (urlText.endsWith('refSeqs.json')) {
99
107
  responseText = '[]'
100
108
  }
101
- return Promise.resolve(new Response(responseText, { url: urlText }))
109
+ return new Response(responseText)
102
110
  }
103
111
  jest.spyOn(global, 'fetch').mockImplementation(mockFetch)
112
+
104
113
  const {
105
114
  findByTestId,
106
115
  getAllByRole,
@@ -1,4 +1,19 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
+ import { WidgetType } from '@jbrowse/core/pluggableElementTypes'
3
+ import PluginManager from '@jbrowse/core/PluginManager'
4
+ import { lazy } from 'react'
2
5
 
3
- export { default as stateModel } from './model'
4
- export const configSchema = ConfigurationSchema('AddConnectionWidget', {})
6
+ import stateModel from './model'
7
+ const configSchema = ConfigurationSchema('AddConnectionWidget', {})
8
+
9
+ export default (pluginManager: PluginManager) => {
10
+ pluginManager.addWidgetType(() => {
11
+ return new WidgetType({
12
+ name: 'AddConnectionWidget',
13
+ heading: 'Add a connection',
14
+ configSchema,
15
+ stateModel,
16
+ ReactComponent: lazy(() => import('./components/AddConnectionWidget')),
17
+ })
18
+ })
19
+ }
@@ -52,10 +52,13 @@ function standardInitializer() {
52
52
  const realLocation = window.location
53
53
 
54
54
  // https://stackoverflow.com/a/60110508/2129219
55
- function setWindowLoc(loc) {
55
+ function setWindowLoc(loc: string) {
56
+ // @ts-ignore
56
57
  delete window.location
58
+ // @ts-ignore
57
59
  window.location = new URL(loc)
58
60
  }
61
+
59
62
  const FakeViewModel = types.model('FakeView', {
60
63
  id: types.identifier,
61
64
  type: types.literal('FakeView'),
@@ -67,7 +70,7 @@ const FakeViewModel = types.model('FakeView', {
67
70
  class FakeViewPlugin extends Plugin {
68
71
  name = 'FakeViewPlugin'
69
72
 
70
- install(pluginManager) {
73
+ install(pluginManager: PluginManager) {
71
74
  pluginManager.addViewType(() => {
72
75
  return new ViewType({
73
76
  name: 'FakeView',
@@ -79,7 +82,7 @@ class FakeViewPlugin extends Plugin {
79
82
  }
80
83
 
81
84
  describe('tests on an LGV type system with view.assemblyNames, using URL', () => {
82
- let session
85
+ let session: ReturnType<typeof standardInitializer>
83
86
  beforeEach(() => {
84
87
  session = standardInitializer()
85
88
  })
@@ -89,7 +92,6 @@ describe('tests on an LGV type system with view.assemblyNames, using URL', () =>
89
92
  })
90
93
 
91
94
  it('adds relative URL (BAM)', () => {
92
- console.warn = jest.fn()
93
95
  const { widget } = session
94
96
  widget.setTrackData({
95
97
  uri: 'volvox-sorted.bam',
@@ -135,45 +137,40 @@ describe('tests on an LGV type system with view.assemblyNames, using URL', () =>
135
137
  })
136
138
  })
137
139
 
138
- describe('tests on an view without view.assemblyNames', () => {
139
- let session
140
- beforeEach(() => {
141
- const pluginManager = new PluginManager([new FakeViewPlugin()])
142
- pluginManager.createPluggableElements()
143
- pluginManager.configure()
144
- const SessionModel = types.model({
145
- view: FakeViewModel,
146
- widget: stateModelFactory(pluginManager),
147
- })
140
+ test('tests on an view without view.assemblyNames', () => {
141
+ const pluginManager = new PluginManager([new FakeViewPlugin()])
142
+ pluginManager.createPluggableElements()
143
+ pluginManager.configure()
148
144
 
149
- // no assemblyNames on the view, just in case some view does not implement
150
- // view.assemblyNames (it is just a convenience)
151
- session = SessionModel.create({
152
- view: {
153
- type: 'FakeView',
154
- id: 'testing',
155
- },
156
- widget: {
157
- type: 'AddTrackWidget',
158
- view: 'testing',
159
- },
160
- })
145
+ const SessionModel = types.model({
146
+ view: FakeViewModel,
147
+ widget: stateModelFactory(pluginManager),
148
+ })
149
+ // no assemblyNames on the view, just in case some view does not implement
150
+ // view.assemblyNames (it is just a convenience)
151
+ const session = SessionModel.create({
152
+ view: {
153
+ type: 'FakeView',
154
+ id: 'testing',
155
+ },
156
+ widget: {
157
+ type: 'AddTrackWidget',
158
+ view: 'testing',
159
+ },
161
160
  })
162
161
 
163
- it('adds url', () => {
164
- const { widget } = session
165
- widget.setTrackData({
166
- uri: 'volvox-sorted.bam',
167
- locationType: 'UriLocation',
168
- })
169
- expect(widget.trackName).toBe('volvox-sorted.bam')
170
- expect(widget.isRelativeUrl).toBe(true)
171
- expect(widget.assembly).toBe(undefined)
162
+ const { widget } = session
163
+ widget.setTrackData({
164
+ uri: 'volvox-sorted.bam',
165
+ locationType: 'UriLocation',
172
166
  })
167
+ expect(widget.trackName).toBe('volvox-sorted.bam')
168
+ expect(widget.isRelativeUrl).toBe(true)
169
+ expect(widget.assembly).toBe(undefined)
173
170
  })
174
171
 
175
172
  describe('tests different file types', () => {
176
- let session
173
+ let session: ReturnType<typeof standardInitializer>
177
174
  beforeEach(() => {
178
175
  session = standardInitializer()
179
176
  })
@@ -229,7 +226,7 @@ describe('tests different file types', () => {
229
226
  })
230
227
 
231
228
  describe('tests localpath', () => {
232
- let session
229
+ let session: ReturnType<typeof standardInitializer>
233
230
  beforeEach(() => {
234
231
  session = standardInitializer()
235
232
  })
@@ -1,4 +1,19 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
+ import { WidgetType } from '@jbrowse/core/pluggableElementTypes'
3
+ import PluginManager from '@jbrowse/core/PluginManager'
4
+ import { lazy } from 'react'
2
5
 
3
- export { default as stateModelFactory } from './model'
4
- export const configSchema = ConfigurationSchema('AddTrackWidget', {})
6
+ import stateModelFactory from './model'
7
+ const configSchema = ConfigurationSchema('AddTrackWidget', {})
8
+
9
+ export default (pluginManager: PluginManager) => {
10
+ pluginManager.addWidgetType(() => {
11
+ return new WidgetType({
12
+ name: 'AddTrackWidget',
13
+ heading: 'Add a track',
14
+ configSchema,
15
+ stateModel: stateModelFactory(pluginManager),
16
+ ReactComponent: lazy(() => import('./components/AddTrackWidget')),
17
+ })
18
+ })
19
+ }
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { createJBrowseTheme } from '@jbrowse/core/ui'
3
3
  import { createTestSession } from '@jbrowse/web/src/rootModel'
4
- import { cleanup, render } from '@testing-library/react'
4
+ import { render } from '@testing-library/react'
5
5
  import { ThemeProvider } from '@mui/material/styles'
6
6
 
7
7
  // locals
@@ -13,140 +13,136 @@ jest.mock('@jbrowse/web/src/makeWorkerInstance', () => () => {})
13
13
  window.requestIdleCallback = cb => cb()
14
14
  window.cancelIdleCallback = () => {}
15
15
 
16
- describe('HierarchicalTrackSelector widget', () => {
17
- afterEach(cleanup)
16
+ test('renders nothing with no assembly', () => {
17
+ const session = createTestSession()
18
+ const firstView = session.addView('LinearGenomeView')
19
+ const model = firstView.activateTrackSelector()
18
20
 
19
- it('renders nothing with no assembly', () => {
20
- const session = createTestSession()
21
- const firstView = session.addView('LinearGenomeView')
22
- const model = firstView.activateTrackSelector()
21
+ const { container } = render(
22
+ <ThemeProvider theme={createJBrowseTheme()}>
23
+ {/* @ts-ignore*/}
24
+ <HierarchicalTrackSelector model={model} />
25
+ </ThemeProvider>,
26
+ )
27
+ expect(container.firstChild).toMatchSnapshot()
28
+ })
23
29
 
24
- const { container } = render(
25
- <ThemeProvider theme={createJBrowseTheme()}>
26
- {/* @ts-ignore*/}
27
- <HierarchicalTrackSelector model={model} />
28
- </ThemeProvider>,
29
- )
30
- expect(container.firstChild).toMatchSnapshot()
30
+ test('renders with a couple of uncategorized tracks', async () => {
31
+ const session = createTestSession()
32
+ session.addAssemblyConf({
33
+ name: 'volMyt1',
34
+ sequence: {
35
+ trackId: 'sequenceConfigId',
36
+ type: 'ReferenceSequenceTrack',
37
+ adapter: {
38
+ type: 'FromConfigSequenceAdapter',
39
+ features: [
40
+ {
41
+ refName: 'ctgA',
42
+ uniqueId: 'firstId',
43
+ start: 0,
44
+ end: 10,
45
+ seq: 'cattgttgcg',
46
+ },
47
+ ],
48
+ },
49
+ },
31
50
  })
32
-
33
- it('renders with a couple of uncategorized tracks', async () => {
34
- const session = createTestSession()
35
- session.addAssemblyConf({
36
- name: 'volMyt1',
37
- sequence: {
38
- trackId: 'sequenceConfigId',
39
- type: 'ReferenceSequenceTrack',
40
- adapter: {
41
- type: 'FromConfigSequenceAdapter',
42
- features: [
43
- {
44
- refName: 'ctgA',
45
- uniqueId: 'firstId',
46
- start: 0,
47
- end: 10,
48
- seq: 'cattgttgcg',
49
- },
50
- ],
51
- },
51
+ session.addTrackConf({
52
+ trackId: 'fooC',
53
+ assemblyNames: ['volMyt1'],
54
+ type: 'FeatureTrack',
55
+ adapter: { type: 'FromConfigAdapter', features: [] },
56
+ })
57
+ session.addTrackConf({
58
+ trackId: 'barC',
59
+ assemblyNames: ['volMyt1'],
60
+ type: 'FeatureTrack',
61
+ adapter: { type: 'FromConfigAdapter', features: [] },
62
+ })
63
+ const firstView = session.addView('LinearGenomeView', {
64
+ displayedRegions: [
65
+ {
66
+ assemblyName: 'volMyt1',
67
+ refName: 'ctgA',
68
+ start: 0,
69
+ end: 1000,
52
70
  },
53
- })
54
- session.addTrackConf({
55
- trackId: 'fooC',
56
- assemblyNames: ['volMyt1'],
57
- type: 'FeatureTrack',
58
- adapter: { type: 'FromConfigAdapter', features: [] },
59
- })
60
- session.addTrackConf({
61
- trackId: 'barC',
62
- assemblyNames: ['volMyt1'],
63
- type: 'FeatureTrack',
64
- adapter: { type: 'FromConfigAdapter', features: [] },
65
- })
66
- const firstView = session.addView('LinearGenomeView', {
67
- displayedRegions: [
68
- {
69
- assemblyName: 'volMyt1',
70
- refName: 'ctgA',
71
- start: 0,
72
- end: 1000,
73
- },
74
- ],
75
- })
76
- firstView.showTrack(session.sessionTracks[0].trackId)
77
- firstView.showTrack(session.sessionTracks[1].trackId)
78
- const model = firstView.activateTrackSelector()
79
-
80
- const { container, findByTestId } = render(
81
- <ThemeProvider theme={createJBrowseTheme()}>
82
- {/* @ts-ignore*/}
83
- <HierarchicalTrackSelector model={model} />
84
- </ThemeProvider>,
85
- )
86
- await findByTestId('hierarchical_track_selector')
87
- expect(container.firstChild).toMatchSnapshot()
71
+ ],
88
72
  })
73
+ firstView.showTrack(session.sessionTracks[0].trackId)
74
+ firstView.showTrack(session.sessionTracks[1].trackId)
75
+ const model = firstView.activateTrackSelector()
89
76
 
90
- it('renders with a couple of categorized tracks', async () => {
91
- const session = createTestSession()
92
- session.addAssemblyConf({
93
- name: 'volMyt1',
94
- sequence: {
95
- trackId: 'sequenceConfigId',
96
- type: 'ReferenceSequenceTrack',
97
- adapter: {
98
- type: 'FromConfigSequenceAdapter',
99
- features: [
100
- {
101
- refName: 'ctgA',
102
- uniqueId: 'firstId',
103
- start: 0,
104
- end: 10,
105
- seq: 'cattgttgcg',
106
- },
107
- ],
108
- },
109
- },
110
- })
77
+ const { container, findByTestId } = render(
78
+ <ThemeProvider theme={createJBrowseTheme()}>
79
+ {/* @ts-ignore*/}
80
+ <HierarchicalTrackSelector model={model} />
81
+ </ThemeProvider>,
82
+ )
83
+ await findByTestId('hierarchical_track_selector')
84
+ expect(container.firstChild).toMatchSnapshot()
85
+ })
111
86
 
112
- session.addTrackConf({
113
- trackId: 'fooC',
114
- assemblyNames: ['volMyt1'],
115
- type: 'FeatureTrack',
116
- adapter: { type: 'FromConfigAdapter', features: [] },
117
- })
118
- session.addTrackConf({
119
- trackId: 'barC',
120
- assemblyNames: ['volMyt1'],
121
- type: 'FeatureTrack',
122
- adapter: { type: 'FromConfigAdapter', features: [] },
123
- })
124
- const firstView = session.addView('LinearGenomeView', {
125
- displayedRegions: [
126
- {
127
- assemblyName: 'volMyt1',
128
- refName: 'ctgA',
129
- start: 0,
130
- end: 1000,
131
- },
132
- ],
133
- })
134
- firstView.showTrack(session.sessionTracks[0].trackId)
135
- firstView.showTrack(session.sessionTracks[1].trackId)
136
- firstView.tracks[0].configuration.category.set(['Foo Category'])
137
- firstView.tracks[1].configuration.category.set([
138
- 'Foo Category',
139
- 'Bar Category',
140
- ])
141
- const model = firstView.activateTrackSelector()
87
+ test('renders with a couple of categorized tracks', async () => {
88
+ const session = createTestSession()
89
+ session.addAssemblyConf({
90
+ name: 'volMyt1',
91
+ sequence: {
92
+ trackId: 'sequenceConfigId',
93
+ type: 'ReferenceSequenceTrack',
94
+ adapter: {
95
+ type: 'FromConfigSequenceAdapter',
96
+ features: [
97
+ {
98
+ refName: 'ctgA',
99
+ uniqueId: 'firstId',
100
+ start: 0,
101
+ end: 10,
102
+ seq: 'cattgttgcg',
103
+ },
104
+ ],
105
+ },
106
+ },
107
+ })
142
108
 
143
- const { container, findByTestId } = render(
144
- <ThemeProvider theme={createJBrowseTheme()}>
145
- {/* @ts-ignore*/}
146
- <HierarchicalTrackSelector model={model} />
147
- </ThemeProvider>,
148
- )
149
- await findByTestId('hierarchical_track_selector')
150
- expect(container.firstChild).toMatchSnapshot()
109
+ session.addTrackConf({
110
+ trackId: 'fooC',
111
+ assemblyNames: ['volMyt1'],
112
+ type: 'FeatureTrack',
113
+ adapter: { type: 'FromConfigAdapter', features: [] },
114
+ })
115
+ session.addTrackConf({
116
+ trackId: 'barC',
117
+ assemblyNames: ['volMyt1'],
118
+ type: 'FeatureTrack',
119
+ adapter: { type: 'FromConfigAdapter', features: [] },
151
120
  })
121
+ const firstView = session.addView('LinearGenomeView', {
122
+ displayedRegions: [
123
+ {
124
+ assemblyName: 'volMyt1',
125
+ refName: 'ctgA',
126
+ start: 0,
127
+ end: 1000,
128
+ },
129
+ ],
130
+ })
131
+ firstView.showTrack(session.sessionTracks[0].trackId)
132
+ firstView.showTrack(session.sessionTracks[1].trackId)
133
+ firstView.tracks[0].configuration.category.set(['Foo Category'])
134
+ firstView.tracks[1].configuration.category.set([
135
+ 'Foo Category',
136
+ 'Bar Category',
137
+ ])
138
+ const model = firstView.activateTrackSelector()
139
+
140
+ const { container, findByTestId } = render(
141
+ <ThemeProvider theme={createJBrowseTheme()}>
142
+ {/* @ts-ignore*/}
143
+ <HierarchicalTrackSelector model={model} />
144
+ </ThemeProvider>,
145
+ )
146
+ await findByTestId('hierarchical_track_selector')
147
+ expect(container.firstChild).toMatchSnapshot()
152
148
  })
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`HierarchicalTrackSelector widget renders nothing with no assembly 1`] = `
3
+ exports[`renders nothing with no assembly 1`] = `
4
4
  <button
5
5
  class="MuiButtonBase-root MuiFab-root MuiFab-circular MuiFab-sizeSmall MuiFab-secondary MuiFab-root MuiFab-circular MuiFab-sizeSmall MuiFab-secondary css-15opis6-MuiButtonBase-root-MuiFab-root-fab"
6
6
  tabindex="0"
@@ -23,7 +23,7 @@ exports[`HierarchicalTrackSelector widget renders nothing with no assembly 1`] =
23
23
  </button>
24
24
  `;
25
25
 
26
- exports[`HierarchicalTrackSelector widget renders with a couple of categorized tracks 1`] = `
26
+ exports[`renders with a couple of categorized tracks 1`] = `
27
27
  <div
28
28
  data-testid="hierarchical_track_selector"
29
29
  >
@@ -81,7 +81,7 @@ exports[`HierarchicalTrackSelector widget renders with a couple of categorized t
81
81
  Filter tracks
82
82
  </label>
83
83
  <div
84
- class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1wz39fi-MuiInputBase-root-MuiInput-root"
84
+ class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1blad95-MuiInputBase-root-MuiInput-root"
85
85
  >
86
86
  <input
87
87
  aria-invalid="false"
@@ -120,7 +120,7 @@ exports[`HierarchicalTrackSelector widget renders with a couple of categorized t
120
120
  </div>
121
121
  `;
122
122
 
123
- exports[`HierarchicalTrackSelector widget renders with a couple of uncategorized tracks 1`] = `
123
+ exports[`renders with a couple of uncategorized tracks 1`] = `
124
124
  <div
125
125
  data-testid="hierarchical_track_selector"
126
126
  >
@@ -178,7 +178,7 @@ exports[`HierarchicalTrackSelector widget renders with a couple of uncategorized
178
178
  Filter tracks
179
179
  </label>
180
180
  <div
181
- class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1wz39fi-MuiInputBase-root-MuiInput-root"
181
+ class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-colorPrimary MuiInputBase-fullWidth MuiInputBase-formControl MuiInputBase-sizeSmall MuiInputBase-adornedEnd css-1blad95-MuiInputBase-root-MuiInput-root"
182
182
  >
183
183
  <input
184
184
  aria-invalid="false"
@@ -1,5 +1,22 @@
1
1
  import stateModelFactory, { HierarchicalTrackSelectorModel } from './model'
2
2
  import configSchema from './configSchema'
3
+ import PluginManager from '@jbrowse/core/PluginManager'
4
+ import { WidgetType } from '@jbrowse/core/pluggableElementTypes'
5
+ import { lazy } from 'react'
3
6
 
4
7
  export { stateModelFactory, configSchema }
5
8
  export type { HierarchicalTrackSelectorModel }
9
+
10
+ export default (pluginManager: PluginManager) => {
11
+ pluginManager.addWidgetType(() => {
12
+ return new WidgetType({
13
+ name: 'HierarchicalTrackSelectorWidget',
14
+ heading: 'Available tracks',
15
+ configSchema,
16
+ stateModel: stateModelFactory(pluginManager),
17
+ ReactComponent: lazy(
18
+ () => import('./components/HierarchicalTrackSelector'),
19
+ ),
20
+ })
21
+ })
22
+ }