( expectedText: string | undefined = undefined, )
| 211 | * @param expectedText optional DOM text. |
| 212 | */ |
| 213 | export 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 | |
| 238 | export function matchI18nMutableOpCodes( |
| 239 | expectedMutableOpCodes: string[], |
no test coverage detected
searching dependent graphs…