forked from nukeop/nuclear
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/app/app/containers/LibraryViewContainer/LibraryViewContainer.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { waitFor } from '@testing-library/react'; | ||
|
||
import { buildStoreState } from '../../../test/storeBuilders'; | ||
import { mountedComponentFactory, setupI18Next } from '../../../test/testUtils'; | ||
|
||
describe('Library view container', () => { | ||
beforeAll(() => { | ||
setupI18Next(); | ||
}); | ||
|
||
it('should display local library', () => { | ||
const { component } = mountComponent(); | ||
|
||
expect(component.asFragment()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should add a folder to the local library', async () => { | ||
const { component } = mountComponent(); | ||
|
||
await waitFor(() => component.getByText(/add folders/i).click()); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const remote = require('electron').remote; | ||
expect(remote.dialog.showOpenDialog).toHaveBeenCalledWith( | ||
'currentWindow', | ||
{ | ||
properties: ['openDirectory', 'multiSelections'] | ||
} | ||
); | ||
}); | ||
|
||
const mountComponent = mountedComponentFactory( | ||
['/library'], | ||
buildStoreState() | ||
.withPlugins() | ||
.withConnectivity() | ||
.withLocal() | ||
.build() | ||
); | ||
}); |
120 changes: 120 additions & 0 deletions
120
.../app/app/containers/LibraryViewContainer/__snapshots__/LibraryViewContainer.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Library view container should display local library 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="main_layout_container" | ||
> | ||
<div | ||
class="local_files_view" | ||
> | ||
<div | ||
class="library_header_row" | ||
> | ||
<div | ||
class="header_container" | ||
> | ||
Local Library | ||
</div> | ||
<button | ||
class="ui basic icon button" | ||
> | ||
<i | ||
aria-hidden="true" | ||
class="chevron up icon" | ||
/> | ||
</button> | ||
</div> | ||
<div | ||
class="ui segment library_folders" | ||
> | ||
<div | ||
class="ui segment control_bar" | ||
> | ||
<button | ||
class="ui icon inverted left labeled button add_folder" | ||
> | ||
<i | ||
aria-hidden="true" | ||
class="folder open icon" | ||
/> | ||
Add folders | ||
</button> | ||
<button | ||
class="ui icon inverted disabled button refresh_icon" | ||
disabled="" | ||
tabindex="-1" | ||
> | ||
<i | ||
aria-hidden="true" | ||
class="refresh icon" | ||
/> | ||
</button> | ||
</div> | ||
</div> | ||
<div | ||
class="ui segment library_contents" | ||
> | ||
<div | ||
class="search_field_row" | ||
> | ||
<div | ||
class="ui inverted transparent left icon input" | ||
> | ||
<input | ||
placeholder="Filter..." | ||
type="text" | ||
/> | ||
<i | ||
aria-hidden="true" | ||
class="search icon" | ||
/> | ||
</div> | ||
<div | ||
class="ui buttons library_list_type_toggle" | ||
> | ||
<button | ||
class="ui active icon inverted button" | ||
> | ||
<i | ||
aria-hidden="true" | ||
class="unordered list icon" | ||
/> | ||
</button> | ||
<button | ||
class="ui icon inverted button" | ||
> | ||
<i | ||
aria-hidden="true" | ||
class="th icon" | ||
/> | ||
</button> | ||
<button | ||
class="ui icon inverted button" | ||
> | ||
<i | ||
aria-hidden="true" | ||
class="folder icon" | ||
/> | ||
</button> | ||
</div> | ||
</div> | ||
<div | ||
class="library_empty_state" | ||
> | ||
<i | ||
aria-hidden="true" | ||
class="file audio outline icon" | ||
/> | ||
<h2> | ||
The library is empty | ||
</h2> | ||
<div> | ||
Try adding some music using the button above. | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</DocumentFragment> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters