Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ana/3133 loader on networks page missing #3159

Merged
merged 3 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/ana_3133-loader-networks-page-missing
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Changed] [#3133](https://github.com/cosmos/lunie/issues/3133) Now the networks page also has a loader @Bitcoinera
7 changes: 5 additions & 2 deletions src/components/network/PageNetworks.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<TmPage data-title="Network" class="page" hide-header>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will accept the PR but want to show you that TmPage already has logic for loading states. Check PageValidator

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I saw! Thank you for the hint 😉 !

<template>
<TmDataLoading v-if="$apollo.loading" />
<template v-else-if="!$apollo.loading">
<h3>Main Networks</h3>
<NetworkList :networks="mainNetworks" />
<h3>Test Networks</h3>
Expand All @@ -12,13 +13,15 @@
<script>
import { Networks, NetworksResult } from "src/gql"
import NetworkList from "./NetworkList"
import TmDataLoading from "common/TmDataLoading"

import TmPage from "common/TmPage"
export default {
name: `page-network`,
components: {
TmPage,
NetworkList
NetworkList,
TmDataLoading
},
data: () => ({
networks: []
Expand Down
12 changes: 11 additions & 1 deletion tests/unit/specs/components/network/PageNetworks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ describe(`PageNetworks`, () => {
}
]

const $apollo = {
queries: {
parameters: {
loading: false,
error: undefined
}
}
}

beforeEach(() => {
wrapper = shallowMount(PageNetworks, {
localVue,
Expand All @@ -40,7 +49,8 @@ describe(`PageNetworks`, () => {
},
$router: {
push: jest.fn()
}
},
$apollo
},
stubs: [`router-link`]
})
Expand Down