How to use the sortablejs.mockImplementation function in sortablejs

To help you get started, we’ve selected a few sortablejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SortableJS / Vue.Draggable / tests / unit / vuedraggable.integrated.spec.js View on Github external
import { mount } from "@vue/test-utils";
import Sortable from "sortablejs";
jest.genMockFromModule('sortablejs');
jest.mock('sortablejs');
const SortableFake = {
  destroy: jest.fn(),
  option: jest.fn()
};
Sortable.mockImplementation(() => SortableFake);

import Vue from "vue";
import DraggableWithList from "./helper/DraggableWithList"
import DraggableWithModel from "./helper/DraggableWithList"
import DraggableWithTransition from "./helper/DraggableWithTransition"

import draggable from "@/vuedraggable";

let wrapper;
let element;
let vm;

function getEvent(name) {
  return Sortable.mock.calls[0][1][name];
}
github SortableJS / Vue.Draggable / tests / unit / vuedraggable.spec.js View on Github external
import { mount, shallowMount } from "@vue/test-utils";
import Sortable from "sortablejs";
jest.genMockFromModule('sortablejs');
jest.mock('sortablejs');
const SortableFake = {
  destroy: jest.fn(),
  option: jest.fn()
};
Sortable.mockImplementation(() => SortableFake);
import draggable from "@/vuedraggable";
import Vue from "vue";
import Fake from "./helper/FakeComponent.js"
import FakeFunctional from "./helper/FakeFunctionalComponent.js"


let wrapper;
let vm;
let props;
let items;
let item;
let element;
let input;
const initialRender = "<div><header></header><div>a</div><div>b</div><div>c</div><footer></footer></div>";
const initialRenderRaw = "<div><div>a</div><div>b</div><div>c</div></div>";
const initialRenderTransition = "<div><span><div>a</div><div>b</div><div>c</div></span></div>";

sortablejs

JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis