本文整理汇总了TypeScript中@ephox/alloy.Invalidating.isInvalid方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Invalidating.isInvalid方法的具体用法?TypeScript Invalidating.isInvalid怎么用?TypeScript Invalidating.isInvalid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/alloy.Invalidating
的用法示例。
在下文中一共展示了Invalidating.isInvalid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: f
(doc, body, gui, component, store) => {
const input = component.getSystem().getByDom(
SelectorFind.descendant(component.element(), 'input').getOrDie('Could not find input in colorinput')
).getOrDie();
const legend = component.getSystem().getByDom(
// Intentionally, only finding direct child
SelectorFind.descendant(component.element(), 'span').getOrDie('Could not find legend in colorinput')
).getOrDie();
const sSetColorInputValue = (newValue: string) => Step.sync(() => {
// Once we put more identifying marks on a colorinput, use that instead.
const colorinput = component.components()[0];
Representing.setValue(colorinput, newValue);
});
const sOpenPicker = Logger.t(
'Clicking the legend should bring up the colorswatch',
GeneralSteps.sequence([
Mouse.sClickOn(legend.element(), 'root:span'),
UiFinder.sWaitFor('Waiting for colorswatch to show up!', sink, '.tox-swatches')
])
);
const sAssertFocusedValue = (label: string, expected: string) => Logger.t(label, Chain.asStep(sink, [
FocusTools.cGetActiveValue,
Assertions.cAssertEq('Checking value of focused element', expected)
]));
const sAssertLegendBackground = (label: string, f) => Assertions.sAssertStructure(
label + ': Checking background of legend button',
ApproxStructure.build((s, str, arr) => {
return s.element('span', {
styles: {
'background-color': f(s, str, arr)
}
});
}),
legend.element()
);
const sAssertContainerClasses = (label: string, f) => {
return Waiter.sTryUntil(
label + ': Checking classes on container',
Assertions.sAssertStructure(
'Checking classes only',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
classes: f(s, str, arr)
// ignore children
});
}),
Traverse.parent(input.element()).getOrDie('Could not find parent of input')
),
100,
1000
);
};
return [
TestHelpers.GuiSetup.mAddStyles(doc, [
'.tox-textbox-field-invalid input { outline: 2px solid red; }',
'.tox-color-input span { padding: 4px 8px; }',
'.tox-swatch { padding: 8px 4px }'
]),
Assertions.sAssertStructure(
'Checking initial structure',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
children: [
s.element('div', {
children: [
// Ignore other information because it is subject to change. No oxide example yet.
s.element('label', { }),
s.element('div', {
children: [
s.element('input', { }),
s.element('span', { })
]
})
]
})
]
});
}),
component.element()
),
Logger.t(
'Initially, the colour should not be invalid',
GeneralSteps.sequence([
Assertions.sAssertEq('Invalidating.isInvalid', false, Invalidating.isInvalid(input))
])
),
Logger.t(
'Type an invalid colour: "notblue"',
GeneralSteps.sequence([
FocusTools.sSetFocus('Move focus to input field', component.element(), 'input'),
FocusTools.sSetActiveValue(doc, 'notblue'),
//.........这里部分代码省略.........