Skip to content

Commit 6c4ebb0

Browse files
author
Guillaume Chau
committed
fix(ui): folder loading indicator + e2e tests
1 parent 545cc3f commit 6c4ebb0

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

packages/@vue/cli-ui/src/components/FolderExplorer.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@
127127
</div>
128128

129129
<div ref="folders" class="folders">
130-
<template v-if="folderCurrent.children">
130+
<VueLoadingIndicator
131+
v-if="loading"
132+
class="overlay"
133+
/>
134+
<template v-else-if="folderCurrent.children">
131135
<FolderExplorerItem
132136
v-for="folder of folderCurrent.children"
133137
v-if="showHidden || !folder.hidden"
@@ -153,6 +157,7 @@ const SHOW_HIDDEN = 'vue-ui.show-hidden-folders'
153157
export default {
154158
data () {
155159
return {
160+
loading: 0,
156161
error: false,
157162
editingPath: false,
158163
editedPath: '',
@@ -166,6 +171,7 @@ export default {
166171
folderCurrent: {
167172
query: FOLDER_CURRENT,
168173
fetchPolicy: 'network-only',
174+
loadingKey: 'loading',
169175
async result () {
170176
await this.$nextTick()
171177
this.$refs.folders.scrollTop = 0
@@ -374,4 +380,5 @@ export default {
374380
flex 100% 1 1
375381
overflow-x hidden
376382
overflow-y auto
383+
position relative
377384
</style>

packages/@vue/cli-ui/src/graphql-api/connectors/cwd.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const path = require('path')
55
let cwd = process.cwd()
66

77
function normalize (value) {
8+
if (value.length === 1) return value
89
const lastChar = value.charAt(value.length - 1)
910
if (lastChar === path.sep) {
1011
value = value.substr(0, value.length - 1)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function isValidName (name) {
2+
return !name.match(/[/@\s+%:]/) && encodeURIComponent(name) === name
3+
}

packages/@vue/cli-ui/src/views/ProjectCreate.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@
418418

419419
<script>
420420
import Prompts from '../mixins/Prompts'
421+
import { isValidName } from '../util/folders'
421422
422423
import CWD from '../graphql/cwd.gql'
423424
import PROJECT_CREATION from '../graphql/projectCreation.gql'
@@ -486,8 +487,7 @@ export default {
486487
487488
computed: {
488489
folderNameValid () {
489-
const name = this.formData.folder
490-
return !name.match(/[/@\s+%:]/) && encodeURIComponent(name) === name
490+
return isValidName(this.formData.folder)
491491
},
492492
493493
detailsValid () {

packages/@vue/cli-ui/tests/e2e/specs/g1-projects.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Vue project manager', () => {
1919
cy.get('.change-folder').click()
2020
cy.get('.create').within(() => {
2121
cy.get('.folder-explorer').should('be.visible')
22-
cy.get('.current-path').click()
22+
cy.get('.edit-path-button').click()
2323
cy.get('.path-input input').clear().type(Cypress.env('cwd') + '{enter}')
2424
cy.get('.create-project').click()
2525
})
@@ -71,7 +71,7 @@ describe('Vue project manager', () => {
7171
cy.get('.tab-button').eq(2).click()
7272
cy.get('.import').within(() => {
7373
cy.get('.folder-explorer').should('be.visible')
74-
cy.get('.current-path').click()
74+
cy.get('.edit-path-button').click()
7575
cy.get('.path-input input').clear().type(Cypress.env('cwd') + '{enter}')
7676
cy.get(`.folder-explorer-item:contains('cli-ui-test')`).click()
7777
cy.get('.import-project').should('not.have.class', 'disabled').click()

0 commit comments

Comments
 (0)