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); const $parent = parent && $(parent);
if (style.overflow && style.overflow !== 'visible') return; 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 ( if (
$parent && $parent &&
$parent.css('display') == 'flex' && $parent.css('display') == 'flex' &&
@ -623,7 +624,7 @@ export default Backbone.View.extend({
// Check if the target could accept the source // Check if the target could accept the source
let droppable = trgModel.get('droppable'); let droppable = trgModel.get('droppable');
if (typeof droppable === 'function') { if (typeof droppable === 'function') {
let res = droppable(src, trg); let res = droppable(srcModel, trgModel);
result.droppable = res; result.droppable = res;
result.dropInfo = res; result.dropInfo = res;
droppable = 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 parentModel;
var parentView; var parentView;
var sorter; var sorter;
beforeEach(() => { beforeEach(() => {
parentModel = new Component({ parentModel = new Component({
droppable: (src, target) => { droppable: (srcModel, trgModel) => {
if (src.className === 'canDrop') { if (srcModel.getEl().className === 'canDrop') {
return true; return true;
} }
return false; return false;

Loading…
Cancel
Save