本文整理匯總了TypeScript中@ephox/boulder.FieldSchema.option方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FieldSchema.option方法的具體用法?TypeScript FieldSchema.option怎麽用?TypeScript FieldSchema.option使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/boulder.FieldSchema
的用法示例。
在下文中一共展示了FieldSchema.option方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const sTestScenario = function (rawScenario) {
const scenario = ValueSchema.asRawOrDie('Checking scenario', ValueSchema.objOf([
FieldSchema.strict('label'),
FieldSchema.defaulted('content', ''),
FieldSchema.defaulted('node', Element.fromText('')),
FieldSchema.strictObjOf('fields', [
FieldSchema.option('url'),
FieldSchema.option('text'),
FieldSchema.option('title'),
FieldSchema.option('target')
]),
FieldSchema.strict('expected'),
FieldSchema.defaulted('beforeExecute', Step.pass),
FieldSchema.defaulted('mutations', Fun.constant(Step.pass))
]), rawScenario);
return Logger.t(
scenario.label,
GeneralSteps.sequence([
tEditor.sPrepareState(scenario.node.dom(), scenario.content),
sClickLink,
TestUi.sSetFieldOptValue(scenario.fields.url),
sClickNext,
sAssertTextFocused,
TestUi.sSetFieldOptValue(scenario.fields.text),
sClickNext,
sAssertTitleFocused,
TestUi.sSetFieldOptValue(scenario.fields.title),
sClickNext,
sAssertTargetFocused,
TestUi.sSetFieldOptValue(scenario.fields.target),
sClickPrev,
sAssertTitleFocused,
sClickPrev,
sAssertTextFocused,
sClickPrev,
sAssertUrlFocused,
scenario.beforeExecute,
Keyboard.sKeydown(doc, Keys.enter(), { }),
tEditor.sAssertEq('Checking insert content', scenario.expected),
scenario.mutations(scenario.node),
tEditor.sClear
])
);
};
示例2: function
const checkApply = function (rawScenario) {
const schema = ValueSchema.objOfOnly([
FieldSchema.strict('label'),
FieldSchema.strictObjOf('info', [
FieldSchema.option('url'),
FieldSchema.option('text'),
FieldSchema.option('title'),
FieldSchema.option('target'),
FieldSchema.option('link')
]),
FieldSchema.defaulted('mutations', Fun.noop),
FieldSchema.defaulted('expected', [ ])
]);
const scenario = ValueSchema.asRawOrDie(rawScenario.label, schema, rawScenario);
Logger.sync('setInfo ... ' + scenario.label, function () {
store.clear();
LinkBridge.applyInfo(editor, scenario.info);
store.assertEq('Checking store', scenario.expected);
const link = scenario.info.link.bind(Fun.identity);
link.each(scenario.mutations);
});
};
示例3:
}
}],
action: (comp) => {
detail.onAction(comp);
}
})
),
apis
};
};
export const Notification = Sketcher.single<NotificationSketchSpec, NotificationSketchDetail>({
name: 'Notification',
factory,
configFields: [
FieldSchema.option('level'),
FieldSchema.strict('progress'),
FieldSchema.strict('icon'),
FieldSchema.strict('onAction'),
FieldSchema.strict('text'),
FieldSchema.strict('iconProvider'),
FieldSchema.strict('translationProvider'),
],
apis: {
updateProgress: (apis: NotificationSketchApis, comp: AlloyComponent, percent: number) => {
apis.updateProgress(comp, percent);
},
updateText: (apis: NotificationSketchApis, comp: AlloyComponent, text: string) => {
apis.updateText(comp, text);
}
}
示例4:
import { FieldSchema, ValueSchema } from '@ephox/boulder';
import { Fun } from '@ephox/katamari';
import { Element, Traverse } from '@ephox/sugar';
export default ValueSchema.objOf([
FieldSchema.strictObjOf('editor', [
// Maybe have frame as a method, but I doubt it ... I think we pretty much need a frame
FieldSchema.strict('getFrame'),
FieldSchema.option('getBody'),
FieldSchema.option('getDoc'),
FieldSchema.option('getWin'),
FieldSchema.option('getSelection'),
FieldSchema.option('setSelection'),
FieldSchema.option('clearSelection'),
FieldSchema.option('cursorSaver'),
FieldSchema.option('onKeyup'),
FieldSchema.option('onNodeChanged'),
FieldSchema.option('getCursorBox'),
FieldSchema.strict('onDomChanged'),
FieldSchema.defaulted('onTouchContent', Fun.noop),
FieldSchema.defaulted('onTapContent', Fun.noop),
FieldSchema.defaulted('onTouchToolstrip', Fun.noop),
FieldSchema.defaulted('onScrollToCursor', Fun.constant({ unbind: Fun.noop })),
FieldSchema.defaulted('onScrollToElement', Fun.constant({ unbind: Fun.noop })),
FieldSchema.defaulted('onToEditing', Fun.constant({ unbind: Fun.noop })),
FieldSchema.defaulted('onToReading', Fun.constant({ unbind: Fun.noop })),