Skip to content

Commit

Permalink
Splitview option (#77)
Browse files Browse the repository at this point in the history
* WIP: splitView toggle button
* WIP: refactoring for multiple windows support
* ADDED: window id to winState object
* ADDED: WinState.toJSON getter that returns current state settings
* ADDED: send new dualView parameter to main process on change
* ADDED: fake remote.getCurrentWindow() in e2e build, fixes tests
* OOPS: added missing file
* CLEANED-UP: tabDefault -> viewDefault, appState.addCache -> appState.addView, added appSate.addWindow()
* FIXED: restore dualView with saved window state
* ADDED: nav spec file
* IMPROVED: CSS in single view mode
* FIXED: build on Catalina
* BUMPED: version to 2.1.0
  • Loading branch information
warpdesign committed Nov 1, 2019
1 parent 5029abd commit c4544d4
Show file tree
Hide file tree
Showing 26 changed files with 623 additions and 385 deletions.
3 changes: 2 additions & 1 deletion e2e/cypress/integration/app.spec.ts
Expand Up @@ -12,7 +12,8 @@ describe('app shortcuts', () => {

beforeEach(() => {
cy.window().then(win => {
const cache = win.appState.views[0].caches[0];
cy.log('appState', win.appState);
const cache = win.appState.winStates[0].views[0].caches[0];
cy.spy(cache, 'navHistory').as('navHistory');
});
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/cypress/integration/filetable.spec.ts
Expand Up @@ -43,7 +43,7 @@ describe("filetable", () => {

function resetSelection() {
cy.window().then(win => {
win.appState.views.forEach((view: any) => {
win.appState.winStates[0].views.forEach((view: any) => {
view.caches.forEach((cache: any) => {
cache.reset();
});
Expand All @@ -58,7 +58,7 @@ describe("filetable", () => {
stubs.rename = [];

cy.window().then(win => {
const views = win.appState.views;
const views = win.appState.winStates[0].views;
cy.spy(win.appState, "updateSelection").as("updateSelection");

for (let view of views) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/integration/keyboard.hotkeys.spec.ts
Expand Up @@ -11,7 +11,7 @@ describe("keyboard hotkeys", () => {
stubs.navHistory = [];

cy.window().then(win => {
const views = win.appState.views;
const views = win.appState.winStates[0].views;
for (let view of views) {
for (let cache of view.caches) {
stubs.navHistory.push(cy.spy(cache, "navHistory"));
Expand Down
83 changes: 83 additions & 0 deletions e2e/cypress/integration/nav.spec.ts
@@ -0,0 +1,83 @@
/// <reference types="cypress"/>
import { Classes } from '@blueprintjs/core';

describe('app shortcuts', () => {
before(() => {
cy.visit('http://127.0.0.1:8080');
});

beforeEach(() => {
// load files
cy.CDAndList(0, "/");
cy.get("#view_0 [data-cy-path]")
.invoke("val", "/")
.focus()
.blur();
});

it('explorer tab should be active', () => {
cy.get('.data-cy-explorer-tab')
.should('have.class', Classes.INTENT_PRIMARY)

cy.get(".downloads").should("not.exist");
cy.get(".sideview.active").should("be.visible");
});

it('click on nav tabs should activate each tab', () => {
cy.get('.data-cy-downloads-tab')
.click()
.should('have.class', Classes.INTENT_PRIMARY)
.then(() => {
cy.get('.data-cy-explorer-tab')
.should('not.have.class', Classes.INTENT_PRIMARY);

cy.get(".downloads").should("exist");
cy.get(".sideview.active").should("not.be.visible");
});

cy.get('.data-cy-explorer-tab')
.click()
.should('have.class', Classes.INTENT_PRIMARY)
.then(() => {
cy.get('.data-cy-downloads-tab')
.should('not.have.class', Classes.INTENT_PRIMARY);

cy.get(".downloads").should("not.exist");
cy.get(".sideview.active").should("be.visible");
});
});

it('click on dual should toggle dual view', () => {
cy.get('.data-cy-toggle-splitview')
.click()
.should('have.class', Classes.INTENT_PRIMARY)
.should('have.class', Classes.ACTIVE);

cy.get('#view_1')
.should('be.visible');

cy.get('.data-cy-toggle-splitview')
.click()
.should('not.have.class', Classes.INTENT_PRIMARY)
.should('not.have.class', Classes.ACTIVE);

cy.get('#view_1')
.should('not.be.visible');
});

it('click on app menu should toggle app menu', () => {
cy.get('.data-cy-toggle-app-menu')
.click()
.should('have.class', Classes.ACTIVE);

cy.get('.data-cy-app-menu')
.should('be.visible');

cy.get('.data-cy-toggle-app-menu')
.click()
.should('not.have.class', Classes.ACTIVE);

cy.get('.data-cy-app-menu')
.should('not.be.visible');
});
});
4 changes: 2 additions & 2 deletions e2e/cypress/integration/toolbar.spec.ts
Expand Up @@ -14,7 +14,7 @@ describe("toolbar", () => {
stubs.reload = [];

cy.window().then(win => {
const views = win.appState.views;
const views = win.appState.winStates[0].views;
for (let view of views) {
for (let cache of view.caches) {
const stub = cy.stub(cache, "cd", path => {
Expand Down Expand Up @@ -92,7 +92,7 @@ describe("toolbar", () => {

it("path should get updated when fileState is updated", () => {
cy.window().then(win => {
win.appState.views[0].caches[0].updatePath("/newPath");
win.appState.winStates[0].views[0].caches[0].updatePath("/newPath");
cy.get("#view_0 [data-cy-path]").should("have.value", "/newPath");
});
});
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/support/commands.ts
Expand Up @@ -19,7 +19,7 @@ export function CDList(viewId = 0, path: string, fixture = "files.json") {
return cy.window().then(win => {
cy.fixture(fixture).then(json => {
if (win.appState && win.appState.caches) {
const fileCache = win.appState.views[viewId].caches[0];
const fileCache = win.appState.winStates[0].views[viewId].caches[0];
fileCache.updatePath(path);
fileCache.files.replace(json);
fileCache.setStatus("ok");
Expand Down
8 changes: 4 additions & 4 deletions e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/webpack.config.e2e.js
Expand Up @@ -16,7 +16,7 @@ const baseConfig = {
os: `{release: function() { return "${release}"}, tmpdir: function() { return "/tmpdir" }, homedir: function() { return "/homedir" }}`,
process: `{process: "foo", platform: "${platform}"}`,
electron:
'{ipcRenderer: {send: function() {}, on: function() {}}, remote: { Menu: { buildFromTemplate: function() { return { popup: function() {}, closePopup: function() { } };}},app: { getLocale: function() { return "en"; }, getPath: function(str) { return "cy_" + str; } } } }',
'{ipcRenderer: {send: function() {}, on: function() {}}, remote: { getCurrentWindow: () => {}, Menu: { buildFromTemplate: function() { return { popup: function() {}, closePopup: function() { } };}},app: { getLocale: function() { return "en"; }, getPath: function(str) { return "cy_" + str; } } } }',
child_process: "{exec: function(str, cb) { cb(); }}",
fs: "{}",
path: "{}",
Expand Down

0 comments on commit c4544d4

Please sign in to comment.