Skip to content

Commit

Permalink
Fix commit message (#1283)
Browse files Browse the repository at this point in the history
* Fix commit message

* Add test

* Lint the code
  • Loading branch information
fcollonval authored Oct 26, 2023
1 parent e95a9e5 commit a901350
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/GitPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -788,15 +788,17 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
try {
const author = await this._hasIdentity(this.props.model.pathRepository);

const message = this.props.trans.__('Committing changes...');
const notificationMsg = this.props.trans.__('Committing changes...');
if (id !== null) {
Notification.update({
id,
message,
message: notificationMsg,
autoClose: false
});
} else {
id = Notification.emit(message, 'in-progress', { autoClose: false });
id = Notification.emit(notificationMsg, 'in-progress', {
autoClose: false
});
}

if (this.state.commitAmend) {
Expand Down
44 changes: 44 additions & 0 deletions ui-tests/tests/commit.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { expect, test } from '@jupyterlab/galata';
import path from 'path';
import { extractFile } from './utils';

const baseRepositoryPath = 'test-repository.tar.gz';
test.use({ autoGoto: false });

test.describe('Commit', () => {
test.beforeEach(async ({ page, request, tmpPath }) => {
await extractFile(
request,
path.resolve(__dirname, 'data', baseRepositoryPath),
path.join(tmpPath, 'repository.tar.gz')
);

// URL for merge conflict example repository
await page.goto(`tree/${tmpPath}/test-repository`);
});

test('should commit a change', async ({ page }) => {
await page
.getByRole('listitem', { name: 'Name: another_file.txt' })
.dblclick();
await page
.getByLabel('another_file.txt')
.getByRole('textbox')
.fill('My new content');
await page.keyboard.press('Control+s');

await page.getByRole('tab', { name: 'Git' }).click();
await page.getByTitle('another_file.txt • Modified').hover();
await page.getByRole('button', { name: 'Stage this change' }).click();

await page
.getByPlaceholder('Summary (Ctrl+Enter to commit)')
.fill('My new commit');

await page.getByRole('button', { name: 'Commit', exact: true }).click();

await page.getByRole('tab', { name: 'History' }).click();

await expect(page.getByText('My new commit')).toBeVisible();
});
});

0 comments on commit a901350

Please sign in to comment.