Skip to content

Commit 9d1513b

Browse files
committed
rename a repo init function by the way and fix ts error
1 parent 4fc5a8d commit 9d1513b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

web_src/js/features/repo-settings-branches.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {beforeEach, describe, expect, test, vi} from 'vitest';
2-
import {initRepoBranchesSettings} from './repo-settings-branches.ts';
2+
import {initRepoSettingsBranchesDrag} from './repo-settings-branches.ts';
33
import {POST} from '../modules/fetch.ts';
44
import {createSortable} from '../modules/sortable.ts';
55

@@ -31,7 +31,7 @@ describe('Repository Branch Settings', () => {
3131
});
3232

3333
test('should initialize sortable for protected branches list', () => {
34-
initRepoBranchesSettings();
34+
initRepoSettingsBranchesDrag();
3535

3636
expect(createSortable).toHaveBeenCalledWith(
3737
document.querySelector('#protected-branches-list'),
@@ -45,7 +45,7 @@ describe('Repository Branch Settings', () => {
4545
test('should not initialize if protected branches list is not present', () => {
4646
document.body.innerHTML = '';
4747

48-
initRepoBranchesSettings();
48+
initRepoSettingsBranchesDrag();
4949

5050
expect(createSortable).not.toHaveBeenCalled();
5151
});
@@ -59,7 +59,7 @@ describe('Repository Branch Settings', () => {
5959
return {destroy: vi.fn()};
6060
});
6161

62-
initRepoBranchesSettings();
62+
initRepoSettingsBranchesDrag();
6363

6464
expect(POST).toHaveBeenCalledWith(
6565
'some/repo/branches/priority',

web_src/js/features/repo-settings-branches.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {POST} from '../modules/fetch.ts';
33
import {showErrorToast} from '../modules/toast.ts';
44
import {queryElemChildren} from '../utils/dom.ts';
55

6-
export function initRepoBranchesSettings() {
6+
export function initRepoSettingsBranchesDrag() {
77
const protectedBranchesList = document.querySelector('#protected-branches-list');
88
if (!protectedBranchesList) return;
99

web_src/js/features/repo-settings.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {minimatch} from 'minimatch';
33
import {createMonaco} from './codeeditor.ts';
44
import {onInputDebounce, queryElems, toggleElem} from '../utils/dom.ts';
55
import {POST} from '../modules/fetch.ts';
6-
import {initRepoBranchesSettings} from './repo-settings-branches.ts';
6+
import {initRepoSettingsBranchesDrag} from './repo-settings-branches.ts';
77

88
const {appSubUrl, csrfToken} = window.config;
99

@@ -155,5 +155,5 @@ export function initRepoSettings() {
155155
initRepoSettingsCollaboration();
156156
initRepoSettingsSearchTeamBox();
157157
initRepoSettingsGitHook();
158-
initRepoBranchesSettings();
158+
initRepoSettingsBranchesDrag();
159159
}

web_src/js/modules/sortable.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {SortableOptions, SortableEvent} from 'sortablejs';
22

3-
export async function createSortable(el: HTMLElement, opts: {handle?: string} & SortableOptions = {}) {
3+
export async function createSortable(el: Element, opts: {handle?: string} & SortableOptions = {}) {
44
// @ts-expect-error: wrong type derived by typescript
55
const {Sortable} = await import(/* webpackChunkName: "sortablejs" */'sortablejs');
66

0 commit comments

Comments
 (0)