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

checkout with double click #1424

Merged
merged 1 commit into from
Sep 19, 2020
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ We are following the [Keep a Changelog](https://keepachangelog.com/) format.

## [Unreleased](https://github.com/FredrikNoren/ungit/compare/v1.5.10...master)

### Added
- Doubleclick to checkout [#190](https://github.com/FredrikNoren/ungit/issues/190)

### Changed
- Use page.waitForTimeout API in tests [#1422](https://github.com/FredrikNoren/ungit/pull/1422)
- Bump Dependencies [#1417](https://github.com/FredrikNoren/ungit/pull/1417)
Expand Down
6 changes: 3 additions & 3 deletions clicktests/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@ class Environment {
return this.page.keyboard.press(key);
}

async click(selector) {
async click(selector, clickCount) {
let elementHandle = await this.waitForElementVisible(selector);
try {
await elementHandle.click();
await elementHandle.click({ clickCount: clickCount });
} catch (err1) {
elementHandle = await this.waitForElementVisible(selector);
try {
await elementHandle.click(); // try click a second time to reduce test flakiness
await elementHandle.click({ clickCount: clickCount }); // try click a second time to reduce test flakiness
} catch (err2) {
winston.error(`Failed to click element: ${selector}`);
throw err2;
Expand Down
16 changes: 7 additions & 9 deletions clicktests/spec.generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ const changeTestFile = async (filename, repoPath) => {
path: repoPath,
});
};
const checkout = async (branch) => {
await environment.click(`.branch[data-ta-name="${branch}"]`);
await environment.click('[data-ta-action="checkout"]:not([style*="display: none"]) .dropmask');
await environment.waitForElementVisible(`.ref.branch[data-ta-name="${branch}"].current`);
};
const amendCommit = async () => {
try {
await environment.page.waitForSelector('.amend-button', { visible: true, timeout: 2000 });
Expand Down Expand Up @@ -156,8 +151,10 @@ describe('[GENERIC]', () => {
environment.waitForElementVisible('.commit');
});

it('Checkout a branch', () => {
return checkout('testbranch');
it('Checkout testbranch with action', async () => {
await environment.click('.branch[data-ta-name="testbranch"]');
await environment.click('[data-ta-action="checkout"]:not([style*="display: none"]) .dropmask');
await environment.waitForElementVisible('.ref.branch[data-ta-name="testbranch"].current');
});

it('Create another commit', async () => {
Expand All @@ -169,8 +166,9 @@ describe('[GENERIC]', () => {
return environment.refAction('testbranch', true, 'rebase');
});

it('Checkout master again', () => {
return checkout('master');
it('Checkout master with double click', async () => {
await environment.click('.branch[data-ta-name="master"]', 2);
await environment.waitForElementVisible('.ref.branch[data-ta-name="master"].current');
});

it('Create yet another commit', async () => {
Expand Down
2 changes: 2 additions & 0 deletions components/graph/graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
data-bind="css: { current: current, remote: isRemoteBranch, dragging: isDragging, focused: selected },
html: displayHtml(true),
click: selected,
event: { dblclick: checkout },
dragStart: dragStart, dragEnd: dragEnd, attr: { 'data-ta-name': localRefName, 'data-ta-local': isLocal }"
>
</span>
Expand All @@ -36,6 +37,7 @@
data-bind="css: { current: current, remote: isRemoteTag, dragging: isDragging, focused: selected },
html: displayHtml(true),
click: selected,
event: { dblclick: checkout },
dragStart: dragStart, dragEnd: dragEnd, attr: { 'data-ta-name': localRefName }"
>
</span>
Expand Down