Skip to content

Commit c4544d4

Browse files
authored
Splitview option (#77)
* 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
1 parent 5029abd commit c4544d4

26 files changed

+623
-385
lines changed

e2e/cypress/integration/app.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ describe('app shortcuts', () => {
1212

1313
beforeEach(() => {
1414
cy.window().then(win => {
15-
const cache = win.appState.views[0].caches[0];
15+
cy.log('appState', win.appState);
16+
const cache = win.appState.winStates[0].views[0].caches[0];
1617
cy.spy(cache, 'navHistory').as('navHistory');
1718
});
1819
});

e2e/cypress/integration/filetable.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe("filetable", () => {
4343

4444
function resetSelection() {
4545
cy.window().then(win => {
46-
win.appState.views.forEach((view: any) => {
46+
win.appState.winStates[0].views.forEach((view: any) => {
4747
view.caches.forEach((cache: any) => {
4848
cache.reset();
4949
});
@@ -58,7 +58,7 @@ describe("filetable", () => {
5858
stubs.rename = [];
5959

6060
cy.window().then(win => {
61-
const views = win.appState.views;
61+
const views = win.appState.winStates[0].views;
6262
cy.spy(win.appState, "updateSelection").as("updateSelection");
6363

6464
for (let view of views) {

e2e/cypress/integration/keyboard.hotkeys.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe("keyboard hotkeys", () => {
1111
stubs.navHistory = [];
1212

1313
cy.window().then(win => {
14-
const views = win.appState.views;
14+
const views = win.appState.winStates[0].views;
1515
for (let view of views) {
1616
for (let cache of view.caches) {
1717
stubs.navHistory.push(cy.spy(cache, "navHistory"));
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/// <reference types="cypress"/>
2+
import { Classes } from '@blueprintjs/core';
3+
4+
describe('app shortcuts', () => {
5+
before(() => {
6+
cy.visit('http://127.0.0.1:8080');
7+
});
8+
9+
beforeEach(() => {
10+
// load files
11+
cy.CDAndList(0, "/");
12+
cy.get("#view_0 [data-cy-path]")
13+
.invoke("val", "/")
14+
.focus()
15+
.blur();
16+
});
17+
18+
it('explorer tab should be active', () => {
19+
cy.get('.data-cy-explorer-tab')
20+
.should('have.class', Classes.INTENT_PRIMARY)
21+
22+
cy.get(".downloads").should("not.exist");
23+
cy.get(".sideview.active").should("be.visible");
24+
});
25+
26+
it('click on nav tabs should activate each tab', () => {
27+
cy.get('.data-cy-downloads-tab')
28+
.click()
29+
.should('have.class', Classes.INTENT_PRIMARY)
30+
.then(() => {
31+
cy.get('.data-cy-explorer-tab')
32+
.should('not.have.class', Classes.INTENT_PRIMARY);
33+
34+
cy.get(".downloads").should("exist");
35+
cy.get(".sideview.active").should("not.be.visible");
36+
});
37+
38+
cy.get('.data-cy-explorer-tab')
39+
.click()
40+
.should('have.class', Classes.INTENT_PRIMARY)
41+
.then(() => {
42+
cy.get('.data-cy-downloads-tab')
43+
.should('not.have.class', Classes.INTENT_PRIMARY);
44+
45+
cy.get(".downloads").should("not.exist");
46+
cy.get(".sideview.active").should("be.visible");
47+
});
48+
});
49+
50+
it('click on dual should toggle dual view', () => {
51+
cy.get('.data-cy-toggle-splitview')
52+
.click()
53+
.should('have.class', Classes.INTENT_PRIMARY)
54+
.should('have.class', Classes.ACTIVE);
55+
56+
cy.get('#view_1')
57+
.should('be.visible');
58+
59+
cy.get('.data-cy-toggle-splitview')
60+
.click()
61+
.should('not.have.class', Classes.INTENT_PRIMARY)
62+
.should('not.have.class', Classes.ACTIVE);
63+
64+
cy.get('#view_1')
65+
.should('not.be.visible');
66+
});
67+
68+
it('click on app menu should toggle app menu', () => {
69+
cy.get('.data-cy-toggle-app-menu')
70+
.click()
71+
.should('have.class', Classes.ACTIVE);
72+
73+
cy.get('.data-cy-app-menu')
74+
.should('be.visible');
75+
76+
cy.get('.data-cy-toggle-app-menu')
77+
.click()
78+
.should('not.have.class', Classes.ACTIVE);
79+
80+
cy.get('.data-cy-app-menu')
81+
.should('not.be.visible');
82+
});
83+
});

e2e/cypress/integration/toolbar.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("toolbar", () => {
1414
stubs.reload = [];
1515

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

9393
it("path should get updated when fileState is updated", () => {
9494
cy.window().then(win => {
95-
win.appState.views[0].caches[0].updatePath("/newPath");
95+
win.appState.winStates[0].views[0].caches[0].updatePath("/newPath");
9696
cy.get("#view_0 [data-cy-path]").should("have.value", "/newPath");
9797
});
9898
});

e2e/cypress/support/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function CDList(viewId = 0, path: string, fixture = "files.json") {
1919
return cy.window().then(win => {
2020
cy.fixture(fixture).then(json => {
2121
if (win.appState && win.appState.caches) {
22-
const fileCache = win.appState.views[viewId].caches[0];
22+
const fileCache = win.appState.winStates[0].views[viewId].caches[0];
2323
fileCache.updatePath(path);
2424
fileCache.files.replace(json);
2525
fileCache.setStatus("ok");

e2e/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/webpack.config.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const baseConfig = {
1616
os: `{release: function() { return "${release}"}, tmpdir: function() { return "/tmpdir" }, homedir: function() { return "/homedir" }}`,
1717
process: `{process: "foo", platform: "${platform}"}`,
1818
electron:
19-
'{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; } } } }',
19+
'{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; } } } }',
2020
child_process: "{exec: function(str, cb) { cb(); }}",
2121
fs: "{}",
2222
path: "{}",

0 commit comments

Comments
 (0)