Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
siibra-explorer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiao Gui
siibra-explorer
Commits
5d602e04
Commit
5d602e04
authored
4 years ago
by
Xiao Gui
Browse files
Options
Downloads
Patches
Plain Diff
chore: remove rgn in other tmpl
regionInOtherTmpl is already tested in region.base.spec.ts
parent
609566cf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ui/parcellationRegion/regionMenu/regionMenu.component.spec.ts
+0
-156
0 additions, 156 deletions
...arcellationRegion/regionMenu/regionMenu.component.spec.ts
with
0 additions
and
156 deletions
src/ui/parcellationRegion/regionMenu/regionMenu.component.spec.ts
+
0
−
156
View file @
5d602e04
...
...
@@ -112,161 +112,5 @@ describe('> regionMenu.component.ts', () => {
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
expect
(
fixture
).
toBeTruthy
()
})
describe
(
'
> regionInOtherTemplatesTmpl
'
,
()
=>
{
beforeEach
(()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
viewerStateGetSelectedAtlas
,
{
parcellations
:
[]
}
)
})
it
(
'
> if selector returns empty array, data-available-in-tmpl-count == 0
'
,
()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
regionInOtherTemplateSelector
,
[]
)
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
fixture
.
componentInstance
.
region
=
mr1
fixture
.
detectChanges
()
const
toggleBtn
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
AVAILABILITY_IN_OTHER_REF_SPACE
}
"]`
)
)
expect
(
toggleBtn
.
attributes
[
'
data-available-in-tmpl-count
'
]).
toEqual
(
'
0
'
)
})
it
(
'
> if selector returns non empty array, data-available-in-tmpl-count == array.length
'
,
()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
regionInOtherTemplateSelector
,
nohemisphereHrms
)
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
fixture
.
componentInstance
.
region
=
mr1
fixture
.
detectChanges
()
const
toggleBtn
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
AVAILABILITY_IN_OTHER_REF_SPACE
}
"]`
)
)
expect
(
toggleBtn
.
attributes
[
'
data-available-in-tmpl-count
'
]).
toEqual
(
'
2
'
)
})
it
(
'
> if showRegionInOtherTmpl is set to false, toggle btn will not be shown
'
,
()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
regionInOtherTemplateSelector
,
nohemisphereHrms
)
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
fixture
.
componentInstance
.
region
=
mr1
fixture
.
componentInstance
.
showRegionInOtherTmpl
=
false
fixture
.
detectChanges
()
const
toggleBtn
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
SHOW_IN_OTHER_REF_SPACE
}
"]`
)
)
expect
(
toggleBtn
).
toBeFalsy
()
})
it
(
'
> even if toggleBtn exists, list should be hidden by default
'
,
()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
regionInOtherTemplateSelector
,
nohemisphereHrms
)
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
fixture
.
componentInstance
.
region
=
mr1
fixture
.
detectChanges
()
const
listContainer
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
SHOW_IN_OTHER_REF_SPACE
}
"]`
)
)
expect
(
listContainer
).
toBeFalsy
()
})
it
(
'
> on click of toggle btn, list to become visible
'
,
()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
regionInOtherTemplateSelector
,
nohemisphereHrms
)
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
fixture
.
componentInstance
.
region
=
mr1
fixture
.
detectChanges
()
const
toggleBtn
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
AVAILABILITY_IN_OTHER_REF_SPACE
}
"]`
)
)
toggleBtn
.
triggerEventHandler
(
'
click
'
,
null
)
fixture
.
detectChanges
()
const
listContainer
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
SHOW_IN_OTHER_REF_SPACE
}
"]`
)
)
expect
(
listContainer
).
toBeTruthy
()
})
it
(
'
> once list becomes available, there should be 2 items on the list
'
,
()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
regionInOtherTemplateSelector
,
nohemisphereHrms
)
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
fixture
.
componentInstance
.
region
=
mr1
fixture
.
detectChanges
()
const
toggleBtn
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
AVAILABILITY_IN_OTHER_REF_SPACE
}
"]`
)
)
toggleBtn
.
triggerEventHandler
(
'
click
'
,
null
)
fixture
.
detectChanges
()
const
listContainer
=
fixture
.
debugElement
.
queryAll
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
SHOW_IN_OTHER_REF_SPACE
}
"] [role="button"]`
)
)
expect
(
listContainer
.
length
).
toEqual
(
2
)
})
it
(
'
> the text (no hemisphere metadata) on the list is as expected
'
,
()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
regionInOtherTemplateSelector
,
nohemisphereHrms
)
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
fixture
.
componentInstance
.
region
=
mr1
fixture
.
detectChanges
()
const
toggleBtn
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
AVAILABILITY_IN_OTHER_REF_SPACE
}
"]`
)
)
toggleBtn
.
triggerEventHandler
(
'
click
'
,
null
)
fixture
.
detectChanges
()
const
listContainer
=
fixture
.
debugElement
.
queryAll
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
SHOW_IN_OTHER_REF_SPACE
}
"] [role="button"]`
)
)
// trim white spaces before and after
const
texts
=
listContainer
.
map
(
c
=>
c
.
nativeElement
.
textContent
.
replace
(
/^
\s
+/
,
''
).
replace
(
/
\s
+$/
,
''
))
expect
(
texts
).
toContain
(
mt0
.
name
)
expect
(
texts
).
toContain
(
mt1
.
name
)
})
it
(
'
> the text (with hemisphere metadata) on the list is as expected
'
,
()
=>
{
const
mockStore
=
TestBed
.
inject
(
MockStore
)
mockStore
.
overrideSelector
(
regionInOtherTemplateSelector
,
hemisphereMrms
)
const
fixture
=
TestBed
.
createComponent
(
RegionMenuComponent
)
fixture
.
componentInstance
.
region
=
mr1
fixture
.
detectChanges
()
const
toggleBtn
=
fixture
.
debugElement
.
query
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
AVAILABILITY_IN_OTHER_REF_SPACE
}
"]`
)
)
toggleBtn
.
triggerEventHandler
(
'
click
'
,
null
)
fixture
.
detectChanges
()
const
listContainer
=
fixture
.
debugElement
.
queryAll
(
By
.
css
(
`[aria-label="
${
ARIA_LABELS
.
SHOW_IN_OTHER_REF_SPACE
}
"] [role="button"]`
)
)
// trim white spaces before and after, and middle white spaces into a single white space
const
texts
=
listContainer
.
map
(
c
=>
c
.
nativeElement
.
textContent
.
replace
(
/^
\s
+/
,
''
).
replace
(
/
\s
+$/
,
''
).
replace
(
/
\s
+/g
,
'
'
))
expect
(
texts
).
toContain
(
`
${
mt0
.
name
}
(left hemisphere)`
)
expect
(
texts
).
toContain
(
`
${
mt1
.
name
}
(left hemisphere)`
)
})
})
})
})
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment