MCPcopy Create free account
hub / github.com/ampproject/amphtml / createElement

Function createElement

test/unit/test-mutator.js:62–105  ·  view source on GitHub ↗
(rect)

Source from the content-addressed store, hash-verified

60 });
61
62 function createElement(rect) {
63 const signals = new Signals();
64 return {
65 ownerDocument: {defaultView: window},
66 tagName: 'amp-test',
67 isBuilt: () => {
68 return true;
69 },
70 isUpgraded: () => {
71 return true;
72 },
73 getAttribute: () => {
74 return null;
75 },
76 hasAttribute: () => false,
77 getBoundingClientRect: () => rect,
78 layoutCallback: () => Promise.resolve(),
79 prerenderAllowed: () => true,
80 previewAllowed: () => true,
81 renderOutsideViewport: () => false,
82 unlayoutCallback: () => true,
83 pause: () => {},
84 unmount: () => {},
85 isRelayoutNeeded: () => true,
86 /* eslint-disable local/camelcase */
87 contains: (unused_otherElement) => false,
88 updateLayoutBox: () => {},
89 togglePlaceholder: () => env.sandbox.spy(),
90 overflowCallback: (
91 unused_overflown,
92 unused_requestedHeight,
93 unused_requestedWidth
94 /* eslint-enable local/camelcase */
95 ) => {},
96 getLayoutPriority: () => LayoutPriority_Enum.CONTENT,
97 signals: () => signals,
98 fakeComputedStyle: {
99 marginTop: '0px',
100 marginRight: '0px',
101 marginBottom: '0px',
102 marginLeft: '0px',
103 },
104 };
105 }
106
107 function createResource(id, rect) {
108 const resource = new Resource(id, createElement(rect), resources);

Callers 2

createResourceFunction · 0.70
test-mutator.jsFile · 0.70

Calls 2

resolveMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected