本文整理匯總了TypeScript中@ephox/agar.Assertions.sAssertStructure方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Assertions.sAssertStructure方法的具體用法?TypeScript Assertions.sAssertStructure怎麽用?TypeScript Assertions.sAssertStructure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/agar.Assertions
的用法示例。
在下文中一共展示了Assertions.sAssertStructure方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
(doc, body, gui, component, store) => {
return [
Assertions.sAssertStructure(
'Checking initial structure',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
children: [
s.element('textarea', {
classes: [arr.not('my-custom-editor')]
})
]
});
}),
component.element()
),
RepresentingSteps.sAssertRoundtrip(
'Roundtripping before initialised',
component,
'foo'
),
Logger.t(
'Set to initialised',
Step.sync(() => {
resolveInit.set(true);
})
),
Waiter.sTryUntil(
'Waiting for CustomEditor init',
Assertions.sAssertStructure(
'Checking structure after init',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
children: [
s.element('textarea', {
classes: [arr.has('my-custom-editor')]
})
]
});
}),
component.element()
),
500,
5000
),
RepresentingSteps.sAssertRoundtrip(
'Roundtripping after initialised',
component,
'bar'
)
];
},
示例2:
(doc, body, gui, component, store) => {
// TODO: Fix dupe with Input test. Test Ctrl+Enter.
return [
Assertions.sAssertStructure(
'Checking initial structure',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
classes: [ arr.has('tox-form__group') ],
children: [
s.element('label', {
classes: [ arr.has('tox-label') ],
html: str.is('LabelA')
}),
s.element('textarea', {
classes: [ arr.has('tox-textarea') ],
attrs: {
'data-alloy-tabstop': str.is('true')
}
})
]
});
}),
component.element()
),
RepresentingSteps.sSetValue('basic', component, 'New-Value'),
RepresentingSteps.sAssertComposedValue('basic', 'New-Value', component)
];
},
示例3: function
const sTestDataToHtml = function (editor, data, expected) {
const actual = Element.fromHtml(DataToHtml.dataToHtml(editor, data));
return Waiter.sTryUntil('Wait for structure check',
Assertions.sAssertStructure('Assert equal', expected, actual),
10, 500);
};
示例4:
}, (doc, body, gui, component, store) => {
return [
Assertions.sAssertStructure(
'Assert table structure',
ApproxStructure.fromHtml((
'<table class="tox-dialog__table">' +
'<thead>' +
'<tr>' +
'<th>one</th>' +
'<th>two</th>' +
'<th>three</th>' +
'</tr>' +
'</thead>' +
'<tbody>' +
'<tr>' +
'<td>a</td>' +
'<td>b</td>' +
'<td>c</td>' +
'</tr>' +
'<tr>' +
'<td>d</td>' +
'<td>e</td>' +
'<td>f</td>' +
'</tr>' +
'</tbody>' +
'</table>'
)),
component.element()
)
];
},
示例5:
const sAssertHtmlStructure = (label: string, expectedHtml: string) => Assertions.sAssertStructure(label, ApproxStructure.build((s) => {
return s.element('body', {
children: [
ApproxStructure.fromHtml(expectedHtml),
s.theRest()
]
});
}), editorBody);
示例6: f
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()
);
示例7:
(doc, body, gui, component, store) => {
return [
Assertions.sAssertStructure(
'Checking initial structure',
ApproxStructure.build((s, str, arr) => {
return s.element('div', {
children: [
s.element('label', {
classes: [ arr.has('tox-label') ],
html: str.is('Dropzone Label')
}),
s.element('div', { })
]
});
}),
component.element()
),
Logger.t(
'Trigger drop on zone',
Chain.asStep(component.element(), [
UiFinder.cFindIn('.tox-dropzone'),
Chain.binder(component.getSystem().getByDom),
Chain.op((zone) => {
// TODO: Add 'drop' to NativeEvents
AlloyTriggers.emitWith(zone, 'drop', {
raw: {
dataTransfer: {
files: [
{ name: 'image1.png' },
{ name: 'image2.bmp' },
{ name: 'image3.jpg' }
]
}
}
});
})
])
),
Step.sync(() => {
const zone = Composing.getCurrent(component).getOrDie(
'Failed trying to get the zone from the container'
);
const filesValue = Representing.getValue(zone);
Assertions.assertEq('Checking value of dropzone', [
{ name: 'image1.png' },
{ name: 'image3.jpg' }
], filesValue);
})
];
},
示例8:
const sAssertStandardIframeContent = (frame) => {
// TODO: See if we can match the contents inside the iframe body. That may not be possible though,
// as attempting to use sAssertStructure is throwing permission errors from tests
return Assertions.sAssertStructure(
'Checking to see that the src tag is now set on the iframe',
ApproxStructure.build((s, str, arr) => {
return s.element('iframe', {
classes: [],
attrs: {
src: str.is('javascript:\'\'')
}
});
}),
frame.element()
);
};