本文整理匯總了TypeScript中@ephox/agar.ApproxStructure.build方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ApproxStructure.build方法的具體用法?TypeScript ApproxStructure.build怎麽用?TypeScript ApproxStructure.build使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/agar.ApproxStructure
的用法示例。
在下文中一共展示了ApproxStructure.build方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const sTestEnterAtStartOfAnchorZwsp = function (tinyApis, tinyActions) {
return Logger.t(
'sTestEnterAtStartOfAnchorZwsp',
GeneralSteps.sequence([
sSetup(tinyApis, '<p><a href="#">' + Zwsp.ZWSP + 'a</a></p>', [0, 0, 0], 1),
sEnterKey(tinyActions),
tinyApis.sAssertContentStructure(
ApproxStructure.build(function (s, str, arr) {
return s.element('body', {
children: [
s.element('p', {
children: [
s.element('br', {
attrs: {
'data-mce-bogus': str.is('1')
}
})
]
}),
s.element('p', {
children: addGeckoBr(s, str, [
s.element('a', {
attrs: {
'data-mce-href': str.is('#'),
'href': str.is('#')
},
children: [
s.text(str.is(Zwsp.ZWSP + 'a'))
]
})
])
})
]
});
})
),
tinyApis.sAssertSelection([1, 0, 0], 1, [1, 0, 0], 1)
])
);
};
示例2:
const sAssertInitialIframeStructure = (component: AlloyComponent) => {
return Assertions.sAssertStructure(
'Checking initial structure',
ApproxStructure.build((s, str, arr) => {
const labelStructure = s.element('label', {
classes: [ arr.has('tox-label') ],
html: str.is('iframe label')
});
const iframeStructure = s.element('div', {
classes: [ arr.has('tox-navobj') ],
children: [
s.element('div', {
attrs: {
'data-alloy-tabstop': str.is('true')
}
}),
s.element('iframe', {
classes: [ ],
attrs: {
// Should be no source.
src: str.none()
}
}),
s.element('div', {
attrs: {
'data-alloy-tabstop': str.is('true')
}
})
]
});
return s.element('div', {
classes: [ arr.has('tox-form__group') ],
children: [ labelStructure, iframeStructure ]
});
}),
component.element()
);
};
示例3:
(doc, body, gui, component, store) => {
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') ]
}),
s.element('div', {
classes: [arr.has('tox-selectfield')],
children: [
s.element('select', {
attrs: {
size: str.is('5')
},
children: [
s.element('option', { value: str.is('one'), html: str.is('One') }),
s.element('option', { value: str.is('two'), html: str.is('Two') }),
s.element('option', { value: str.is('three'), html: str.is('Three')}),
s.element('option', { value: str.is('four'), html: str.is('Four') }),
s.element('option', { value: str.is('five'), html: str.is('Five') })
]
})
]
})
]
});
}),
component.element()
),
RepresentingSteps.sSetValue('Choosing three', component, 'three'),
DomSteps.sAssertValue('After setting "three"', 'three', component, 'select'),
RepresentingSteps.sAssertComposedValue('Checking is three', 'three', component)
];
},
示例4: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
tinyApis.sSetContent('[b]a[/b]'),
tinyApis.sAssertContentStructure(ApproxStructure.build(function (s, str) {
return s.element('body', {
children: [
s.element('p', {
children: [
s.element('strong', {
children: [
s.text(str.is('a'))
]
})
]
})
]
});
}))
], onSuccess, onFailure);
}, {
示例5: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
Pipeline.async({}, Log.steps('TBA', 'BBCode: Set bbcode content and assert the equivalent html structure is present', [
tinyApis.sSetContent('[b]a[/b]'),
tinyApis.sAssertContentStructure(ApproxStructure.build(function (s, str) {
return s.element('body', {
children: [
s.element('p', {
children: [
s.element('strong', {
children: [
s.text(str.is('a'))
]
})
]
})
]
});
}))
]), onSuccess, onFailure);
}, {
示例6: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
const tinyApis = TinyApis(editor);
Pipeline.async({},
Log.steps('TBA', 'InsertDateTime: Click on Insertdatetime button and select the first item from the drop down menu. Assert date time is inserted', [
tinyUi.sClickOnToolbar('click on insertdatetime button', '[aria-haspopup="true"]'),
tinyUi.sWaitForUi('wait for menu', '[role="menu"]'),
tinyUi.sClickOnUi('click on first in menu', '[role="menu"] [role="menuitemcheckbox"]:first'),
tinyApis.sAssertContentStructure(ApproxStructure.build(function (s) {
return s.element('body', {
children: [
s.element('p', {
children: [
s.element('time', {})
]
})
]
});
}))
])
, onSuccess, onFailure);
}, {
示例7: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
const tinyApis = TinyApis(editor);
Pipeline.async({}, Log.steps('TBA', 'PageBreak: Click on the pagebreak toolbar button and assert pagebreak is inserted', [
tinyUi.sClickOnToolbar('click on pagebreak button', 'button[aria-label="Page break"]'),
tinyApis.sAssertContentStructure(ApproxStructure.build(function (s, str, arr) {
return s.element('body', {
children: [
s.element('p', {
children: [
s.element('img', {
classes: [
arr.has('mce-pagebreak')
]
})
]
})
]
});
}))
]), onSuccess, onFailure);
}, {
示例8:
const sAssertEditorContentStructure = (editorBody, language, content) => {
return Logger.t('Assert editor contents structure', Waiter.sTryUntil(
'Assert content',
Assertions.sAssertStructure(
'Asserting editor structure',
ApproxStructure.build((s, str, arr) => {
return s.element('body', {
children: [
s.element('pre', {
classes: [
arr.has('language-' + language)
],
attrs: {
contenteditable: str.is('false')
}
}),
s.anything()
]
});
}),
Element.fromDom(editorBody)
), 100, 3000));
};
示例9: function
const sTestEnterAtEndOfAnchorZwspWithAdjacentContent = function (tinyApis, tinyActions) {
return Logger.t(
'sTestEnterAtStartOfAnchorZwspWithAdjacentContent',
GeneralSteps.sequence([
sSetup(tinyApis, '<p>a<a href="#">b' + Zwsp.ZWSP + '</a>c</p>', [0, 1, 0], 1),
sEnterKey(tinyActions),
tinyApis.sAssertContentStructure(
ApproxStructure.build(function (s, str, arr) {
return s.element('body', {
children: [
s.element('p', {
children: [
s.text(str.is('a')),
s.element('a', {
attrs: {
'data-mce-href': str.is('#'),
'href': str.is('#')
},
children: [
s.text(str.is('b'))
]
})
]
}),
s.element('p', {
children: [
s.text(str.is('c'))
]
})
]
});
})
),
tinyApis.sAssertSelection([1, 0], 0, [1, 0], 0)
])
);
};
示例10: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
tinyUi.sClickOnToolbar('click on emoticons button', 'div[aria-label="Emoticons"] > button'),
tinyUi.sClickOnUi('click on kiss', 'a[aria-label="kiss"]'),
tinyApis.sAssertContentStructure(ApproxStructure.build(function (s, str) {
return s.element('body', {
children: [
s.element('p', {
children: [
s.element('img', {
attrs: {
alt: str.is('kiss')
}
})
]
})
]
});
}))
], onSuccess, onFailure);
}, {