feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,41 @@
|
||||
import { MessageBoxType } from '@joplin/lib/shim';
|
||||
import { DialogControl } from '../components/DialogManager';
|
||||
import { PromptButtonSpec } from '../components/DialogManager/types';
|
||||
import makeShowMessageBox from './makeShowMessageBox';
|
||||
|
||||
type OnPrompt = (buttons: PromptButtonSpec[], onDismiss: ()=> void)=> void;
|
||||
const makeMockDialogControl = (onPrompt: OnPrompt): DialogControl => {
|
||||
return {
|
||||
info: jest.fn(),
|
||||
error: jest.fn(),
|
||||
prompt: jest.fn((_title, _message, buttons, options) => {
|
||||
onPrompt(buttons, options.onDismiss);
|
||||
}),
|
||||
promptForText: jest.fn(),
|
||||
showMenu: jest.fn(),
|
||||
};
|
||||
};
|
||||
|
||||
describe('makeShowMessageBox', () => {
|
||||
test('should resolve with the index of the selected button', async () => {
|
||||
const dialogControl = makeMockDialogControl(buttons => {
|
||||
buttons.find(button => button.text === 'OK').onPress();
|
||||
});
|
||||
const showMessageBox = makeShowMessageBox({ current: dialogControl });
|
||||
|
||||
const okButtonIndex = 0;
|
||||
expect(await showMessageBox('test')).toBe(okButtonIndex);
|
||||
});
|
||||
|
||||
test('should resolve to the index of the cancel button when cancelled', async () => {
|
||||
const dialogControl = makeMockDialogControl((_buttons, onDismiss) => {
|
||||
// Cancel
|
||||
onDismiss();
|
||||
});
|
||||
|
||||
const showMessageBox = makeShowMessageBox({ current: dialogControl });
|
||||
expect(await showMessageBox('test')).toBe(1); // Cancel button index
|
||||
// Should resolve to -1 when there is no cancel button
|
||||
expect(await showMessageBox('test', { type: MessageBoxType.Error })).toBe(-1);
|
||||
});
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户