Browse Source

Change droppable arguments to models

pull/3393/head
Ryan Wilson 5 years ago
parent
commit
56e93070a4
  1. 5
      src/utils/Sorter.js
  2. 6
      test/specs/utils/Sorter.js

5
src/utils/Sorter.js

@ -558,7 +558,8 @@ export default Backbone.View.extend({
const $parent = parent && $(parent);
if (style.overflow && style.overflow !== 'visible') return;
if ($el.css('float') && $el.css('float') !== 'none') return;
const propFloat = $el.css('float');
if (propFloat && propFloat !== 'none') return;
if (
$parent &&
$parent.css('display') == 'flex' &&
@ -623,7 +624,7 @@ export default Backbone.View.extend({
// Check if the target could accept the source
let droppable = trgModel.get('droppable');
if (typeof droppable === 'function') {
let res = droppable(src, trg);
let res = droppable(srcModel, trgModel);
result.droppable = res;
result.dropInfo = res;
droppable = res;

6
test/specs/utils/Sorter.js

@ -436,15 +436,15 @@ describe('Sorter', () => {
});
});
describe.only('Valid Target with components', () => {
describe('Valid Target with components', () => {
var parentModel;
var parentView;
var sorter;
beforeEach(() => {
parentModel = new Component({
droppable: (src, target) => {
if (src.className === 'canDrop') {
droppable: (srcModel, trgModel) => {
if (srcModel.getEl().className === 'canDrop') {
return true;
}
return false;

Loading…
Cancel
Save