How to use getDeclarationErrorAddendum method in Playwright Internal

Best JavaScript code snippet using playwright-internal

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

assertValidProps.js

Source: assertValidProps.js Github

copy
1/**
2 * Copyright 2013-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
8 *
9 * @providesModule assertValidProps
10 */
11
12'use strict';
13
14var invariant = require('fbjs/lib/invariant');
15var voidElementTags = require('voidElementTags');
16
17var warning;
18
19
20var HTML = '__html';
21
22function getDeclarationErrorAddendum() {
23  return '';
24}
25
26function assertValidProps(tag: string, props: ?Object, getCurrentOwnerName: () => ?string) {
27  if (!props) {
28    return;
29  }
30  // Note the use of `==` which checks for null or undefined.
31  if (voidElementTags[tag]) {
32    invariant(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must neither have `children` nor ' + 'use `dangerouslySetInnerHTML`.%s', tag, getDeclarationErrorAddendum(getCurrentOwnerName));
33  }
34  if (props.dangerouslySetInnerHTML != null) {
35    invariant(props.children == null, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.');
36    invariant(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.');
37  }
38
39  invariant(props.style == null || typeof props.style === 'object', 'The `style` prop expects a mapping from style properties to values, ' + "not a string. For example, style={{marginRight: spacing + 'em'}} when " + 'using JSX.%s', getDeclarationErrorAddendum(getCurrentOwnerName));
40}
41
42module.exports = assertValidProps;
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Playwright Internal on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)