MCPcopy Index your code
hub / github.com/angular/angular / matchDomText

Function matchDomText

packages/core/test/render3/matchers.ts:213–236  ·  view source on GitHub ↗
(
  expectedText: string | undefined = undefined,
)

Source from the content-addressed store, hash-verified

211 * @param expectedText optional DOM text.
212 */
213export function matchDomText(
214 expectedText: string | undefined = undefined,
215): jasmine.AsymmetricMatcher<Text> {
216 const matcher = function () {};
217 let _actual: any = null;
218
219 matcher.asymmetricMatch = function (actual: any) {
220 _actual = actual;
221 if (!isDOMText(actual)) return false;
222 if (expectedText && expectedText !== actual.textContent) {
223 return false;
224 }
225 return true;
226 };
227 matcher.jasmineToString = function () {
228 let actualStr = isDOMText(_actual)
229 ? `#TEXT: ${JSON.stringify(_actual.textContent)}`
230 : JSON.stringify(_actual);
231 let expectedStr = `#TEXT: ${JSON.stringify(expectedText)}`;
232 return `[${actualStr} != ${expectedStr}]`;
233 };
234
235 return matcher;
236}
237
238export function matchI18nMutableOpCodes(
239 expectedMutableOpCodes: string[],

Callers 1

matchers_spec.tsFile · 0.90

Calls 1

isDOMTextFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…