diff --git a/cypress/e2e/tables-fe-filters.cy.js b/cypress/e2e/tables-fe-filters.cy.js index 78ae816fc..f8ebd54a0 100644 --- a/cypress/e2e/tables-fe-filters.cy.js +++ b/cypress/e2e/tables-fe-filters.cy.js @@ -1,6 +1,6 @@ let localUser -describe('The Home Page', () => { +describe('FE sorting and filtering', () => { before(function() { cy.createRandomUser().then(user => { @@ -64,4 +64,40 @@ describe('The Home Page', () => { cy.loadView('view for second table') cy.get('.info').contains('Reset local adjustments').should('not.exist') }) + + it.only('Navigation filtering', () => { + cy.viewport('macbook-15') + cy.createTable('first table') + cy.createTable('second table') + cy.createTable('third table 🙇') + cy.createTextLineColumn('col1', true) + cy.createView('view for third tab') + + // all tables and views should be visible + cy.get('.app-navigation-entry__title').contains('first table').should('be.visible') + cy.get('.app-navigation-entry__title').contains('second table').should('be.visible') + cy.get('.app-navigation-entry__title').contains('third table 🙇').should('be.visible') + cy.get('.app-navigation-entry__title').contains('view for third tab').should('be.visible') + + // only tables should be visible + cy.get('.filter-box input').clear().type('table') + cy.get('.app-navigation-entry__title').contains('first table').should('be.visible') + cy.get('.app-navigation-entry__title').contains('second table').should('be.visible') + cy.get('.app-navigation-entry__title').contains('third table 🙇').should('be.visible') + cy.get('.app-navigation-entry__title').contains('view for third tab').should('not.exist') + + // only the second table should be visible + cy.get('.filter-box input').clear().type('second') + cy.get('.app-navigation-entry__title').contains('first table').should('not.exist') + cy.get('.app-navigation-entry__title').contains('second table').should('be.visible') + cy.get('.app-navigation-entry__title').contains('third table 🙇').should('not.exist') + cy.get('.app-navigation-entry__title').contains('view for third tab').should('not.exist') + + // only the third table and it's view should be visible + cy.get('.filter-box input').clear().type('view for third') + cy.get('.app-navigation-entry__title').contains('first table').should('not.exist') + cy.get('.app-navigation-entry__title').contains('second table').should('not.exist') + cy.get('.app-navigation-entry__title').contains('third table 🙇').should('be.visible') + cy.get('.app-navigation-entry__title').contains('view for third tab').should('be.visible') + }) }) diff --git a/src/store/store.js b/src/store/store.js index 6a7444197..e1338d604 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -162,6 +162,11 @@ export default new Vuex.Store({ const views = state.views views.push(res.data) commit('setViews', views) + + const tables = state.tables + const table = tables.find(t => t.id === res.data.tableId) + table.views.push(res.data) + return res.data.id }, async updateView({ state, commit, dispatch }, { id, data }) {