MCPcopy
hub / github.com/Maronato/vue-toastification / loadPlugin

Function loadPlugin

tests/utils/plugin.ts:18–55  ·  view source on GitHub ↗
(options?: PluginOptions)

Source from the content-addressed store, hash-verified

16};
17
18const loadPlugin = (options?: PluginOptions) => {
19 // Isolate vue and container
20 const localVue = createLocalVue();
21 const container = document.createElement("div");
22 let containerComp;
23 // Register the plugin and get the container component back
24 localVue.use(Toast, {
25 container,
26 onMounted: (containerComponent) => (containerComp = containerComponent),
27 ...options,
28 });
29 const containerWrapper = createWrapper(
30 (containerComp as unknown) as CombinedVueInstance<
31 Record<never, unknown> & Vue,
32 unknown,
33 unknown,
34 unknown,
35 Record<never, unknown>
36 >
37 );
38
39 const positionContainers = {
40 topLeft: withGetToasts(containerWrapper.find(`.${POSITION.TOP_LEFT}`)),
41 topCenter: withGetToasts(containerWrapper.find(`.${POSITION.TOP_CENTER}`)),
42 topRight: withGetToasts(containerWrapper.find(`.${POSITION.TOP_RIGHT}`)),
43 bottomLeft: withGetToasts(
44 containerWrapper.find(`.${POSITION.BOTTOM_LEFT}`)
45 ),
46 bottomCenter: withGetToasts(
47 containerWrapper.find(`.${POSITION.BOTTOM_CENTER}`)
48 ),
49 bottomRight: withGetToasts(
50 containerWrapper.find(`.${POSITION.BOTTOM_RIGHT}`)
51 ),
52 };
53
54 return { localVue, containerWrapper, ...positionContainers };
55};
56
57export { loadPlugin };

Callers 2

interface.spec.tsFile · 0.90

Calls 1

withGetToastsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…