MCPcopy Create free account
hub / github.com/cutedCha/noteBoook / createMockElement

Function createMockElement

tests/touch-target.property.test.js:116–130  ·  view source on GitHub ↗

* Helper function to create a mock element with specified styles * @param {string} selector - CSS selector/class name * @param {object} styles - Style properties to apply * @returns {HTMLElement} Created element

(selector, styles = {})

Source from the content-addressed store, hash-verified

114 * @returns {HTMLElement} Created element
115 */
116 function createMockElement(selector, styles = {}) {
117 const element = document.createElement('button');
118 element.className = selector.replace('.', '');
119
120 // Apply default touch target styles
121 element.style.minWidth = `${MIN_TOUCH_TARGET_SIZE}px`;
122 element.style.minHeight = `${MIN_TOUCH_TARGET_SIZE}px`;
123
124 // Apply custom styles
125 Object.entries(styles).forEach(([prop, value]) => {
126 element.style[prop] = value;
127 });
128
129 return element;
130 }
131
132 /**
133 * Setup DOM environment before each test

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected