MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / createMockRange

Function createMockRange

test/unit/__mocks__/mockDOM.js:11–29  ·  view source on GitHub ↗
(overrides = {})

Source from the content-addressed store, hash-verified

9 * @returns {Object} Mock Range object
10 */
11export function createMockRange(overrides = {}) {
12 const container = overrides.commonAncestorContainer || document.createElement('div');
13 return {
14 commonAncestorContainer: container,
15 extractContents: jest.fn(() => document.createDocumentFragment()),
16 insertNode: jest.fn(),
17 selectNodeContents: jest.fn(),
18 getBoundingClientRect: jest.fn(() => ({
19 width: 300,
20 height: 100,
21 top: 0,
22 left: 0,
23 right: 300,
24 bottom: 100
25 })),
26 toString: jest.fn(() => ''),
27 ...overrides
28 };
29}
30
31/**
32 * Creates a mock Selection object

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected