Skip to content

Commit a901350

Browse files
authored
Fix commit message (#1283)
* Fix commit message * Add test * Lint the code
1 parent e95a9e5 commit a901350

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

src/components/GitPanel.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,15 +788,17 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
788788
try {
789789
const author = await this._hasIdentity(this.props.model.pathRepository);
790790

791-
const message = this.props.trans.__('Committing changes...');
791+
const notificationMsg = this.props.trans.__('Committing changes...');
792792
if (id !== null) {
793793
Notification.update({
794794
id,
795-
message,
795+
message: notificationMsg,
796796
autoClose: false
797797
});
798798
} else {
799-
id = Notification.emit(message, 'in-progress', { autoClose: false });
799+
id = Notification.emit(notificationMsg, 'in-progress', {
800+
autoClose: false
801+
});
800802
}
801803

802804
if (this.state.commitAmend) {

ui-tests/tests/commit.spec.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { expect, test } from '@jupyterlab/galata';
2+
import path from 'path';
3+
import { extractFile } from './utils';
4+
5+
const baseRepositoryPath = 'test-repository.tar.gz';
6+
test.use({ autoGoto: false });
7+
8+
test.describe('Commit', () => {
9+
test.beforeEach(async ({ page, request, tmpPath }) => {
10+
await extractFile(
11+
request,
12+
path.resolve(__dirname, 'data', baseRepositoryPath),
13+
path.join(tmpPath, 'repository.tar.gz')
14+
);
15+
16+
// URL for merge conflict example repository
17+
await page.goto(`tree/${tmpPath}/test-repository`);
18+
});
19+
20+
test('should commit a change', async ({ page }) => {
21+
await page
22+
.getByRole('listitem', { name: 'Name: another_file.txt' })
23+
.dblclick();
24+
await page
25+
.getByLabel('another_file.txt')
26+
.getByRole('textbox')
27+
.fill('My new content');
28+
await page.keyboard.press('Control+s');
29+
30+
await page.getByRole('tab', { name: 'Git' }).click();
31+
await page.getByTitle('another_file.txt • Modified').hover();
32+
await page.getByRole('button', { name: 'Stage this change' }).click();
33+
34+
await page
35+
.getByPlaceholder('Summary (Ctrl+Enter to commit)')
36+
.fill('My new commit');
37+
38+
await page.getByRole('button', { name: 'Commit', exact: true }).click();
39+
40+
await page.getByRole('tab', { name: 'History' }).click();
41+
42+
await expect(page.getByText('My new commit')).toBeVisible();
43+
});
44+
});

0 commit comments

Comments
 (0)