promethee 1.4.8 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -6
- data/app/assets/javascripts/promethee.js +4 -0
- data/app/assets/stylesheets/promethee-edit.sass +1 -0
- data/config/initializers/assets.rb +1 -0
- data/lib/promethee/rails/version.rb +1 -1
- data/node_modules/angular-summernote/CHANGELOG.md +149 -0
- data/node_modules/angular-summernote/LICENSE-MIT +22 -0
- data/node_modules/angular-summernote/README.md +270 -0
- data/node_modules/angular-summernote/bower.json +49 -0
- data/{vendor/assets/javascripts → node_modules/angular-summernote/dist}/angular-summernote.js +0 -0
- data/node_modules/angular-summernote/dist/angular-summernote.min.js +2 -0
- data/node_modules/angular-summernote/examples/fontstyle-plugin.html +48 -0
- data/node_modules/angular-summernote/examples/index.html +180 -0
- data/node_modules/angular-summernote/examples/index2.html +60 -0
- data/node_modules/angular-summernote/examples/index3.html +57 -0
- data/node_modules/angular-summernote/gulpfile.js +115 -0
- data/node_modules/angular-summernote/package.json +53 -0
- data/node_modules/angular-summernote/src/angular-summernote.js +206 -0
- data/node_modules/angular-summernote/test/angular-summernote.test.js +660 -0
- data/node_modules/angular-summernote/test/chai.conf.js +6 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/index.html +350 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/prettify.css +1 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/prettify.js +1 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/src/angular-summernote.js.html +694 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/src/index.html +350 -0
- data/node_modules/angular-summernote/test/karma-angular-1-2-x.conf.js +33 -0
- data/node_modules/angular-summernote/test/karma-angular-1-3-x.conf.js +33 -0
- data/node_modules/angular-summernote/test/karma-angular-1-4-x.conf.js +33 -0
- data/node_modules/angular-summernote/test/karma-shared.conf.js +64 -0
- data/node_modules/angular-summernote/test/karma.conf.js +33 -0
- data/{vendor/assets/javascripts/summernote/locales/de-DE.js → node_modules/angular-summernote/test/lang/summernote-de-DE.js} +2 -17
- data/node_modules/angular-summernote/test/mocha.conf.js +3 -0
- data/node_modules/angular-ui-sortable/API.md +84 -0
- data/node_modules/angular-ui-sortable/CONTRIBUTING.md +12 -0
- data/node_modules/angular-ui-sortable/LICENSE +21 -0
- data/node_modules/angular-ui-sortable/README.md +350 -0
- data/node_modules/angular-ui-sortable/bower.json +26 -0
- data/node_modules/angular-ui-sortable/demo/demo.css +34 -0
- data/node_modules/angular-ui-sortable/demo/demo.html +29 -0
- data/node_modules/angular-ui-sortable/demo/demo.js +41 -0
- data/node_modules/angular-ui-sortable/dist/sortable.js +593 -0
- data/node_modules/angular-ui-sortable/dist/sortable.min.js +8 -0
- data/node_modules/angular-ui-sortable/gruntFile.js +202 -0
- data/node_modules/angular-ui-sortable/package.json +48 -0
- data/node_modules/angular-ui-sortable/publish.js +41 -0
- data/{vendor/assets/javascripts/ui-sortable.js → node_modules/angular-ui-sortable/src/sortable.js} +106 -200
- data/node_modules/angular-ui-sortable/test/bower_overrides.json +13 -0
- data/node_modules/angular-ui-sortable/test/karma.conf.js +85 -0
- data/node_modules/angular-ui-sortable/test/libs/jquery.simulate.dragandrevert.js +60 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.callbacks.attr.spec.js +199 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.callbacks.spec.js +729 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.directiveoptions.spec.js +554 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.directives.spec.js +371 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.events.spec.js +167 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.multi.spec.js +1232 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.nested.spec.js +186 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.spec.js +895 -0
- data/node_modules/angular-ui-sortable/test/sortable.spec.js +440 -0
- data/node_modules/angular-ui-sortable/test/sortable.test-directives.js +54 -0
- data/node_modules/angular-ui-sortable/test/sortable.test-helper.js +114 -0
- data/node_modules/angular-ui-sortable/test/sortable.tests.css +12 -0
- data/node_modules/ng-file-upload/LICENSE +20 -0
- data/node_modules/ng-file-upload/README.md +616 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/FileAPI.flash.swf +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/FileAPI.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/FileAPI.min.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload-all.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload-all.min.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload-shim.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload-shim.min.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload.min.js +0 -0
- data/node_modules/ng-file-upload/index.js +2 -0
- data/node_modules/ng-file-upload/package.json +42 -0
- data/node_modules/summernote/CODE_OF_CONDUCT.md +46 -0
- data/node_modules/summernote/CONTRIBUTING.md +67 -0
- data/node_modules/summernote/ISSUE_TEMPLATE.md +14 -0
- data/node_modules/summernote/LICENSE +21 -0
- data/node_modules/summernote/PULL_REQUEST_TEMPLATE.md +28 -0
- data/node_modules/summernote/README.md +90 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/base.css +213 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/index.html +262 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/prettify.css +1 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/prettify.js +1 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/sort-arrow-sprite.png +0 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/sorter.js +158 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/Context.js.html +758 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/async.js.html +206 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/dom.js.html +3329 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/env.js.html +386 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/func.js.html +551 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/index.html +171 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/key.js.html +341 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/lists.js.html +695 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/range.js.html +2441 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/Bullet.js.html +668 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/History.js.html +380 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/Style.js.html +539 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/Table.js.html +1787 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/Typing.js.html +335 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/index.html +145 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/index.html +119 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/AirPopover.js.html +284 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/AutoLink.js.html +248 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/AutoSync.js.html +122 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Buttons.js.html +2504 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Clipboard.js.html +149 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Codeview.js.html +434 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Dropzone.js.html +410 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Editor.js.html +2648 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Fullscreen.js.html +218 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Handle.js.html +494 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/HelpDialog.js.html +302 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/HintPopover.js.html +743 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/ImageDialog.js.html +458 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/ImagePopover.js.html +239 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/LinkDialog.js.html +587 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/LinkPopover.js.html +272 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Placeholder.js.html +182 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Statusbar.js.html +191 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/TablePopover.js.html +278 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Toolbar.js.html +473 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/VideoDialog.js.html +680 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/index.html +353 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/renderer.js.html +263 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/summernote-en-US.js.html +542 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs3/index.html +106 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs3/settings.js.html +956 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs3/ui.js.html +776 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs4/index.html +106 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs4/settings.js.html +968 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs4/ui.js.html +791 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/index.html +93 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/index.html +106 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/settings.js.html +953 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui.js.html +1919 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/DropdownUI.js.html +260 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/ModalUI.js.html +167 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/PopoverUI.js.html +347 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/TooltipUI.js.html +344 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/index.html +132 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/summernote.js.html +203 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/Context.spec.js.html +323 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/dom.spec.js.html +1046 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/func.spec.js.html +482 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/index.html +145 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/key.spec.js.html +140 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/lists.spec.js.html +419 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/range.spec.js.html +1286 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/editing/Table.spec.js.html +1724 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/editing/index.html +106 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/editing/style.spec.js.html +341 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/index.html +93 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/module/Codeview.spec.js.html +161 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/module/Editor.spec.js.html +1235 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/module/Fullscreen.spec.js.html +161 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/module/index.html +119 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/bs/module/Buttons.spec.js.html +770 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/bs/module/VideoDialog.spec.js.html +209 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/bs/module/index.html +106 -0
- data/node_modules/summernote/dist/font/summernote.eot +0 -0
- data/node_modules/summernote/dist/font/summernote.ttf +0 -0
- data/node_modules/summernote/dist/font/summernote.woff +0 -0
- data/{vendor/assets/javascripts/summernote/locales/ar-AR.js → node_modules/summernote/dist/lang/summernote-ar-AR.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-ar-AR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/bg-BG.js → node_modules/summernote/dist/lang/summernote-bg-BG.js} +60 -4
- data/node_modules/summernote/dist/lang/summernote-bg-BG.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ca-ES.js → node_modules/summernote/dist/lang/summernote-ca-ES.js} +12 -4
- data/node_modules/summernote/dist/lang/summernote-ca-ES.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/cs-CZ.js → node_modules/summernote/dist/lang/summernote-cs-CZ.js} +50 -4
- data/node_modules/summernote/dist/lang/summernote-cs-CZ.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/da-DK.js → node_modules/summernote/dist/lang/summernote-da-DK.js} +46 -5
- data/node_modules/summernote/dist/lang/summernote-da-DK.min.js +3 -0
- data/node_modules/summernote/dist/lang/summernote-de-DE.js +154 -0
- data/node_modules/summernote/dist/lang/summernote-de-DE.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/el-GR.js → node_modules/summernote/dist/lang/summernote-el-GR.js} +11 -3
- data/node_modules/summernote/dist/lang/summernote-el-GR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/es-ES.js → node_modules/summernote/dist/lang/summernote-es-ES.js} +12 -4
- data/node_modules/summernote/dist/lang/summernote-es-ES.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/es-EU.js → node_modules/summernote/dist/lang/summernote-es-EU.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-es-EU.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/fa-IR.js → node_modules/summernote/dist/lang/summernote-fa-IR.js} +55 -5
- data/node_modules/summernote/dist/lang/summernote-fa-IR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/fi-FI.js → node_modules/summernote/dist/lang/summernote-fi-FI.js} +52 -3
- data/node_modules/summernote/dist/lang/summernote-fi-FI.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/fr-FR.js → node_modules/summernote/dist/lang/summernote-fr-FR.js} +3 -2
- data/node_modules/summernote/dist/lang/summernote-fr-FR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/gl-ES.js → node_modules/summernote/dist/lang/summernote-gl-ES.js} +12 -4
- data/node_modules/summernote/dist/lang/summernote-gl-ES.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/he-IL.js → node_modules/summernote/dist/lang/summernote-he-IL.js} +51 -3
- data/node_modules/summernote/dist/lang/summernote-he-IL.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/hr-HR.js → node_modules/summernote/dist/lang/summernote-hr-HR.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-hr-HR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/hu-HU.js → node_modules/summernote/dist/lang/summernote-hu-HU.js} +25 -5
- data/node_modules/summernote/dist/lang/summernote-hu-HU.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/id-ID.js → node_modules/summernote/dist/lang/summernote-id-ID.js} +56 -4
- data/node_modules/summernote/dist/lang/summernote-id-ID.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/it-IT.js → node_modules/summernote/dist/lang/summernote-it-IT.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-it-IT.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ja-JP.js → node_modules/summernote/dist/lang/summernote-ja-JP.js} +32 -10
- data/node_modules/summernote/dist/lang/summernote-ja-JP.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ko-KR.js → node_modules/summernote/dist/lang/summernote-ko-KR.js} +44 -4
- data/node_modules/summernote/dist/lang/summernote-ko-KR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/lt-LT.js → node_modules/summernote/dist/lang/summernote-lt-LT.js} +52 -4
- data/node_modules/summernote/dist/lang/summernote-lt-LT.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/lt-LV.js → node_modules/summernote/dist/lang/summernote-lt-LV.js} +27 -7
- data/node_modules/summernote/dist/lang/summernote-lt-LV.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/mn-MN.js → node_modules/summernote/dist/lang/summernote-mn-MN.js} +43 -4
- data/node_modules/summernote/dist/lang/summernote-mn-MN.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/nb-NO.js → node_modules/summernote/dist/lang/summernote-nb-NO.js} +53 -3
- data/node_modules/summernote/dist/lang/summernote-nb-NO.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/nl-NL.js → node_modules/summernote/dist/lang/summernote-nl-NL.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-nl-NL.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/pl-PL.js → node_modules/summernote/dist/lang/summernote-pl-PL.js} +46 -3
- data/node_modules/summernote/dist/lang/summernote-pl-PL.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/pt-BR.js → node_modules/summernote/dist/lang/summernote-pt-BR.js} +25 -8
- data/node_modules/summernote/dist/lang/summernote-pt-BR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/pt-PT.js → node_modules/summernote/dist/lang/summernote-pt-PT.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-pt-PT.min.js +3 -0
- data/node_modules/summernote/dist/lang/summernote-ro-RO.js +155 -0
- data/node_modules/summernote/dist/lang/summernote-ro-RO.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ru-RU.js → node_modules/summernote/dist/lang/summernote-ru-RU.js} +46 -3
- data/node_modules/summernote/dist/lang/summernote-ru-RU.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sk-SK.js → node_modules/summernote/dist/lang/summernote-sk-SK.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-sk-SK.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sl-SI.js → node_modules/summernote/dist/lang/summernote-sl-SI.js} +53 -4
- data/node_modules/summernote/dist/lang/summernote-sl-SI.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sr-RS-Latin.js → node_modules/summernote/dist/lang/summernote-sr-RS-Latin.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-sr-RS-Latin.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sr-RS.js → node_modules/summernote/dist/lang/summernote-sr-RS.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-sr-RS.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sv-SE.js → node_modules/summernote/dist/lang/summernote-sv-SE.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-sv-SE.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ta-IN.js → node_modules/summernote/dist/lang/summernote-ta-IN.js} +46 -4
- data/node_modules/summernote/dist/lang/summernote-ta-IN.min.js +3 -0
- data/node_modules/summernote/dist/lang/summernote-th-TH.js +155 -0
- data/node_modules/summernote/dist/lang/summernote-th-TH.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/tr-TR.js → node_modules/summernote/dist/lang/summernote-tr-TR.js} +3 -2
- data/node_modules/summernote/dist/lang/summernote-tr-TR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/uk-UA.js → node_modules/summernote/dist/lang/summernote-uk-UA.js} +48 -4
- data/node_modules/summernote/dist/lang/summernote-uk-UA.min.js +3 -0
- data/node_modules/summernote/dist/lang/summernote-uz-UZ.js +112 -0
- data/node_modules/summernote/dist/lang/summernote-uz-UZ.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/vi-VN.js → node_modules/summernote/dist/lang/summernote-vi-VN.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-vi-VN.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/zh-CN.js → node_modules/summernote/dist/lang/summernote-zh-CN.js} +20 -7
- data/node_modules/summernote/dist/lang/summernote-zh-CN.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/zh-TW.js → node_modules/summernote/dist/lang/summernote-zh-TW.js} +45 -3
- data/node_modules/summernote/dist/lang/summernote-zh-TW.min.js +3 -0
- data/node_modules/summernote/dist/summernote-0.8.10-dist.zip +0 -0
- data/node_modules/summernote/dist/summernote-bs4.css +1 -0
- data/node_modules/summernote/dist/summernote-bs4.js +7323 -0
- data/node_modules/summernote/dist/summernote-bs4.js.map +1 -0
- data/node_modules/summernote/dist/summernote-bs4.min.js +3 -0
- data/node_modules/summernote/dist/summernote-lite.css +1 -0
- data/node_modules/summernote/dist/summernote-lite.js +7837 -0
- data/node_modules/summernote/dist/summernote-lite.js.map +1 -0
- data/node_modules/summernote/dist/summernote.css +1 -0
- data/node_modules/summernote/dist/summernote.js +7315 -0
- data/node_modules/summernote/dist/summernote.js.map +1 -0
- data/node_modules/summernote/dist/summernote.min.js +3 -0
- data/node_modules/summernote/examples/airmode.html +35 -0
- data/node_modules/summernote/examples/bs3.html +60 -0
- data/node_modules/summernote/examples/bs4.html +57 -0
- data/node_modules/summernote/examples/codemirror.html +45 -0
- data/node_modules/summernote/examples/external-api.html +76 -0
- data/node_modules/summernote/examples/hint-emoji.html +61 -0
- data/node_modules/summernote/examples/hint-symbols_mathematical-symbols_Greek-letters.html +54 -0
- data/node_modules/summernote/examples/hint-userdefine.html +48 -0
- data/node_modules/summernote/examples/ie8.html +32 -0
- data/node_modules/summernote/examples/jquery-custom-event.html +119 -0
- data/node_modules/summernote/examples/jquery19lt.html +25 -0
- data/node_modules/summernote/examples/lang.html +33 -0
- data/node_modules/summernote/examples/link-blank.html +33 -0
- data/node_modules/summernote/examples/lite.html +24 -0
- data/node_modules/summernote/examples/nativestyle.html +32 -0
- data/node_modules/summernote/examples/ondialog-multitab.html +77 -0
- data/node_modules/summernote/examples/ondialog.html +58 -0
- data/node_modules/summernote/examples/plugin-hello.html +37 -0
- data/node_modules/summernote/examples/rtl.html +32 -0
- data/node_modules/summernote/examples/symbols_mathematical-symbols_Greek-letters.json +1118 -0
- data/node_modules/summernote/examples/textarea.html +46 -0
- data/node_modules/summernote/examples/toolbar-container.html +35 -0
- data/node_modules/summernote/examples/with-google-font.html +50 -0
- data/node_modules/summernote/index.html +33 -0
- data/node_modules/summernote/karma.conf.js +42 -0
- data/node_modules/summernote/lang/summernote-ar-AR.js +155 -0
- data/node_modules/summernote/lang/summernote-bg-BG.js +155 -0
- data/node_modules/summernote/lang/summernote-ca-ES.js +155 -0
- data/node_modules/summernote/lang/summernote-cs-CZ.js +149 -0
- data/node_modules/summernote/lang/summernote-da-DK.js +155 -0
- data/node_modules/summernote/lang/summernote-de-DE.js +154 -0
- data/node_modules/summernote/lang/summernote-el-GR.js +155 -0
- data/node_modules/summernote/lang/summernote-es-ES.js +155 -0
- data/node_modules/summernote/lang/summernote-es-EU.js +154 -0
- data/node_modules/summernote/lang/summernote-fa-IR.js +155 -0
- data/node_modules/summernote/lang/summernote-fi-FI.js +153 -0
- data/node_modules/summernote/lang/summernote-fr-FR.js +155 -0
- data/node_modules/summernote/lang/summernote-gl-ES.js +155 -0
- data/node_modules/summernote/lang/summernote-he-IL.js +155 -0
- data/node_modules/summernote/lang/summernote-hr-HR.js +155 -0
- data/node_modules/summernote/lang/summernote-hu-HU.js +155 -0
- data/node_modules/summernote/lang/summernote-id-ID.js +155 -0
- data/node_modules/summernote/lang/summernote-it-IT.js +155 -0
- data/node_modules/summernote/lang/summernote-ja-JP.js +155 -0
- data/node_modules/summernote/lang/summernote-ko-KR.js +155 -0
- data/node_modules/summernote/lang/summernote-lt-LT.js +155 -0
- data/node_modules/summernote/lang/summernote-lt-LV.js +155 -0
- data/node_modules/summernote/lang/summernote-mn-MN.js +157 -0
- data/node_modules/summernote/lang/summernote-nb-NO.js +154 -0
- data/node_modules/summernote/lang/summernote-nl-NL.js +155 -0
- data/node_modules/summernote/lang/summernote-pl-PL.js +155 -0
- data/node_modules/summernote/lang/summernote-pt-BR.js +155 -0
- data/node_modules/summernote/lang/summernote-pt-PT.js +154 -0
- data/node_modules/summernote/lang/summernote-ro-RO.js +155 -0
- data/node_modules/summernote/lang/summernote-ru-RU.js +155 -0
- data/node_modules/summernote/lang/summernote-sk-SK.js +153 -0
- data/node_modules/summernote/lang/summernote-sl-SI.js +155 -0
- data/node_modules/summernote/lang/summernote-sr-RS-Latin.js +155 -0
- data/node_modules/summernote/lang/summernote-sr-RS.js +155 -0
- data/node_modules/summernote/lang/summernote-sv-SE.js +155 -0
- data/node_modules/summernote/lang/summernote-ta-IN.js +155 -0
- data/node_modules/summernote/lang/summernote-th-TH.js +155 -0
- data/node_modules/summernote/lang/summernote-tr-TR.js +155 -0
- data/node_modules/summernote/lang/summernote-uk-UA.js +155 -0
- data/node_modules/summernote/lang/summernote-uz-UZ.js +112 -0
- data/node_modules/summernote/lang/summernote-vi-VN.js +155 -0
- data/node_modules/summernote/lang/summernote-zh-CN.js +155 -0
- data/node_modules/summernote/lang/summernote-zh-TW.js +155 -0
- data/node_modules/summernote/package.json +87 -0
- data/{vendor/assets/javascripts → node_modules}/summernote/plugin/databasic/summernote-ext-databasic.css +0 -0
- data/{vendor/assets/javascripts → node_modules}/summernote/plugin/databasic/summernote-ext-databasic.js +62 -73
- data/{vendor/assets/javascripts → node_modules}/summernote/plugin/hello/summernote-ext-hello.js +9 -10
- data/{vendor/assets/javascripts → node_modules}/summernote/plugin/specialchars/summernote-ext-specialchars.js +22 -25
- data/node_modules/summernote/src/icons/align-center.svg +11 -0
- data/node_modules/summernote/src/icons/align-indent.svg +11 -0
- data/node_modules/summernote/src/icons/align-justify.svg +11 -0
- data/node_modules/summernote/src/icons/align-left.svg +12 -0
- data/node_modules/summernote/src/icons/align-outdent.svg +11 -0
- data/node_modules/summernote/src/icons/align-right.svg +11 -0
- data/node_modules/summernote/src/icons/align.svg +8 -0
- data/node_modules/summernote/src/icons/arrow-circle-down.svg +1 -0
- data/node_modules/summernote/src/icons/arrow-circle-left.svg +1 -0
- data/node_modules/summernote/src/icons/arrow-circle-right.svg +1 -0
- data/node_modules/summernote/src/icons/arrow-circle-up.svg +1 -0
- data/node_modules/summernote/src/icons/arrows-alt.svg +11 -0
- data/node_modules/summernote/src/icons/arrows-h.svg +1 -0
- data/node_modules/summernote/src/icons/arrows-v.svg +1 -0
- data/node_modules/summernote/src/icons/bold.svg +11 -0
- data/node_modules/summernote/src/icons/caret.svg +9 -0
- data/node_modules/summernote/src/icons/chain-broken.svg +47 -0
- data/node_modules/summernote/src/icons/circle.svg +10 -0
- data/node_modules/summernote/src/icons/close.svg +16 -0
- data/node_modules/summernote/src/icons/code.svg +11 -0
- data/node_modules/summernote/src/icons/col-after.svg +96 -0
- data/node_modules/summernote/src/icons/col-before.svg +19 -0
- data/node_modules/summernote/src/icons/col-remove.svg +19 -0
- data/node_modules/summernote/src/icons/dist/font/summernote.eot +0 -0
- data/node_modules/summernote/src/icons/dist/font/summernote.ttf +0 -0
- data/node_modules/summernote/src/icons/dist/font/summernote.woff +0 -0
- data/node_modules/summernote/src/icons/dist/summernote.html +536 -0
- data/node_modules/summernote/src/icons/dist/summernote.less +511 -0
- data/node_modules/summernote/src/icons/eraser.svg +13 -0
- data/node_modules/summernote/src/icons/font.svg +11 -0
- data/node_modules/summernote/src/icons/frame.svg +10 -0
- data/node_modules/summernote/src/icons/italic.svg +11 -0
- data/node_modules/summernote/src/icons/link.svg +21 -0
- data/node_modules/summernote/src/icons/magic.svg +10 -0
- data/node_modules/summernote/src/icons/menu-check.svg +8 -0
- data/node_modules/summernote/src/icons/minus.svg +11 -0
- data/node_modules/summernote/src/icons/orderedlist.svg +12 -0
- data/node_modules/summernote/src/icons/pencil.svg +8 -0
- data/node_modules/summernote/src/icons/picture.svg +11 -0
- data/node_modules/summernote/src/icons/question.svg +10 -0
- data/node_modules/summernote/src/icons/redo.svg +10 -0
- data/node_modules/summernote/src/icons/row-above.svg +19 -0
- data/node_modules/summernote/src/icons/row-below.svg +19 -0
- data/node_modules/summernote/src/icons/row-remove.svg +19 -0
- data/node_modules/summernote/src/icons/special-character.svg +10 -0
- data/node_modules/summernote/src/icons/square.svg +10 -0
- data/node_modules/summernote/src/icons/strikethrough.svg +11 -0
- data/node_modules/summernote/src/icons/subscript.svg +11 -0
- data/node_modules/summernote/src/icons/summernote.svg +11 -0
- data/node_modules/summernote/src/icons/superscript.svg +11 -0
- data/node_modules/summernote/src/icons/table.svg +11 -0
- data/node_modules/summernote/src/icons/templates/summernote.css +110 -0
- data/node_modules/summernote/src/icons/templates/summernote.json +5 -0
- data/node_modules/summernote/src/icons/text-height.svg +11 -0
- data/node_modules/summernote/src/icons/trash.svg +17 -0
- data/node_modules/summernote/src/icons/underline.svg +11 -0
- data/node_modules/summernote/src/icons/undo.svg +10 -0
- data/node_modules/summernote/src/icons/unorderedlist.svg +9 -0
- data/node_modules/summernote/src/icons/video.svg +9 -0
- data/node_modules/summernote/src/js/base/Context.js +231 -0
- data/node_modules/summernote/src/js/base/core/async.js +47 -0
- data/node_modules/summernote/src/js/base/core/dom.js +1088 -0
- data/node_modules/summernote/src/js/base/core/env.js +107 -0
- data/node_modules/summernote/src/js/base/core/func.js +162 -0
- data/node_modules/summernote/src/js/base/core/key.js +92 -0
- data/node_modules/summernote/src/js/base/core/lists.js +210 -0
- data/node_modules/summernote/src/js/base/core/range.js +792 -0
- data/node_modules/summernote/src/js/base/editing/Bullet.js +201 -0
- data/node_modules/summernote/src/js/base/editing/History.js +105 -0
- data/node_modules/summernote/src/js/base/editing/Style.js +158 -0
- data/node_modules/summernote/src/js/base/editing/Table.js +574 -0
- data/node_modules/summernote/src/js/base/editing/Typing.js +90 -0
- data/node_modules/summernote/src/js/base/module/AirPopover.js +73 -0
- data/node_modules/summernote/src/js/base/module/AutoLink.js +61 -0
- data/node_modules/summernote/src/js/base/module/AutoSync.js +19 -0
- data/node_modules/summernote/src/js/base/module/Buttons.js +813 -0
- data/node_modules/summernote/src/js/base/module/Clipboard.js +28 -0
- data/node_modules/summernote/src/js/base/module/Codeview.js +123 -0
- data/node_modules/summernote/src/js/base/module/Dropzone.js +115 -0
- data/node_modules/summernote/src/js/base/module/Editor.js +861 -0
- data/node_modules/summernote/src/js/base/module/Fullscreen.js +51 -0
- data/node_modules/summernote/src/js/base/module/Handle.js +143 -0
- data/node_modules/summernote/src/js/base/module/HelpDialog.js +79 -0
- data/node_modules/summernote/src/js/base/module/HintPopover.js +226 -0
- data/node_modules/summernote/src/js/base/module/ImageDialog.js +131 -0
- data/node_modules/summernote/src/js/base/module/ImagePopover.js +58 -0
- data/node_modules/summernote/src/js/base/module/LinkDialog.js +174 -0
- data/node_modules/summernote/src/js/base/module/LinkPopover.js +69 -0
- data/node_modules/summernote/src/js/base/module/Placeholder.js +39 -0
- data/node_modules/summernote/src/js/base/module/Statusbar.js +42 -0
- data/node_modules/summernote/src/js/base/module/TablePopover.js +71 -0
- data/node_modules/summernote/src/js/base/module/Toolbar.js +136 -0
- data/node_modules/summernote/src/js/base/module/VideoDialog.js +205 -0
- data/node_modules/summernote/src/js/base/renderer.js +66 -0
- data/node_modules/summernote/src/js/base/summernote-en-US.js +159 -0
- data/node_modules/summernote/src/js/bs3/settings.js +297 -0
- data/node_modules/summernote/src/js/bs3/ui.js +237 -0
- data/node_modules/summernote/src/js/bs4/settings.js +301 -0
- data/node_modules/summernote/src/js/bs4/ui.js +242 -0
- data/node_modules/summernote/src/js/lite/settings.js +296 -0
- data/node_modules/summernote/src/js/lite/ui.js +618 -0
- data/node_modules/summernote/src/js/lite/ui/DropdownUI.js +65 -0
- data/node_modules/summernote/src/js/lite/ui/ModalUI.js +34 -0
- data/node_modules/summernote/src/js/lite/ui/PopoverUI.js +94 -0
- data/node_modules/summernote/src/js/lite/ui/TooltipUI.js +93 -0
- data/node_modules/summernote/src/js/summernote.js +46 -0
- data/node_modules/summernote/src/less/elements.less +149 -0
- data/node_modules/summernote/src/less/elements.scss +149 -0
- data/node_modules/summernote/src/less/lite-ui/all.less +15 -0
- data/node_modules/summernote/src/less/lite-ui/btn-group.less +51 -0
- data/node_modules/summernote/src/less/lite-ui/buttons.less +102 -0
- data/node_modules/summernote/src/less/lite-ui/common.less +20 -0
- data/node_modules/summernote/src/less/lite-ui/dropdown.less +39 -0
- data/node_modules/summernote/src/less/lite-ui/form.less +43 -0
- data/node_modules/summernote/src/less/lite-ui/mixins.less +1 -0
- data/node_modules/summernote/src/less/lite-ui/mixins/buttons.less +40 -0
- data/node_modules/summernote/src/less/lite-ui/modal.less +104 -0
- data/node_modules/summernote/src/less/lite-ui/popover.less +121 -0
- data/node_modules/summernote/src/less/lite-ui/toolbar.less +4 -0
- data/node_modules/summernote/src/less/lite-ui/tooltip.less +66 -0
- data/node_modules/summernote/src/less/lite-ui/variables.less +81 -0
- data/node_modules/summernote/src/less/summernote-bs4.less +577 -0
- data/node_modules/summernote/src/less/summernote-bs4.scss +560 -0
- data/node_modules/summernote/src/less/summernote-lite.less +601 -0
- data/node_modules/summernote/src/less/summernote.less +576 -0
- data/node_modules/summernote/src/less/summernote.scss +560 -0
- data/node_modules/summernote/tsconfig.json +12 -0
- metadata +459 -69
- data/vendor/assets/fonts/summernote.eot +0 -0
- data/vendor/assets/fonts/summernote.ttf +0 -0
- data/vendor/assets/fonts/summernote.woff +0 -0
- data/vendor/assets/javascripts/summernote/index.js +0 -1
- data/vendor/assets/javascripts/summernote/locales/index.js +0 -1
- data/vendor/assets/javascripts/summernote/locales/ro-RO.js +0 -102
- data/vendor/assets/javascripts/summernote/locales/th-TH.js +0 -106
- data/vendor/assets/javascripts/summernote/summernote-bs4.js +0 -7990
- data/vendor/assets/javascripts/summernote/summernote-lite.js +0 -8598
- data/vendor/assets/javascripts/summernote/summernote.js +0 -7987
- data/vendor/assets/stylesheets/summernote-bs4.css +0 -1
- data/vendor/assets/stylesheets/summernote-lite.css +0 -1
- data/vendor/assets/stylesheets/summernote.scss +0 -1
@@ -0,0 +1,1232 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
describe('uiSortable', function() {
|
4
|
+
|
5
|
+
beforeEach(module(function($compileProvider) {
|
6
|
+
if (typeof $compileProvider.debugInfoEnabled === 'function') {
|
7
|
+
$compileProvider.debugInfoEnabled(false);
|
8
|
+
}
|
9
|
+
}));
|
10
|
+
|
11
|
+
// Ensure the sortable angular module is loaded
|
12
|
+
beforeEach(module('ui.sortable'));
|
13
|
+
beforeEach(module('ui.sortable.testHelper'));
|
14
|
+
|
15
|
+
var EXTRA_DY_PERCENTAGE, listContent, listInnerContent, simulateElementDrag, hasUndefinedProperties, beforeLiElement, afterLiElement;
|
16
|
+
|
17
|
+
beforeEach(inject(function (sortableTestHelper) {
|
18
|
+
EXTRA_DY_PERCENTAGE = sortableTestHelper.EXTRA_DY_PERCENTAGE;
|
19
|
+
listContent = sortableTestHelper.listContent;
|
20
|
+
listInnerContent = sortableTestHelper.listInnerContent;
|
21
|
+
simulateElementDrag = sortableTestHelper.simulateElementDrag;
|
22
|
+
hasUndefinedProperties = sortableTestHelper.hasUndefinedProperties;
|
23
|
+
beforeLiElement = sortableTestHelper.extraElements && sortableTestHelper.extraElements.beforeLiElement;
|
24
|
+
afterLiElement = sortableTestHelper.extraElements && sortableTestHelper.extraElements.afterLiElement;
|
25
|
+
}));
|
26
|
+
|
27
|
+
tests.description = 'Multiple sortables related';
|
28
|
+
function tests (useExtraElements) {
|
29
|
+
|
30
|
+
var host;
|
31
|
+
|
32
|
+
beforeEach(inject(function() {
|
33
|
+
host = $('<div id="test-host"></div>');
|
34
|
+
$('body').append(host);
|
35
|
+
|
36
|
+
if (!useExtraElements) {
|
37
|
+
beforeLiElement = afterLiElement = '';
|
38
|
+
}
|
39
|
+
}));
|
40
|
+
|
41
|
+
afterEach(function() {
|
42
|
+
host.remove();
|
43
|
+
host = null;
|
44
|
+
});
|
45
|
+
|
46
|
+
it('should update model when sorting between sortables', function() {
|
47
|
+
inject(function($compile, $rootScope) {
|
48
|
+
var elementTop, elementBottom;
|
49
|
+
elementTop = $compile(''.concat(
|
50
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
51
|
+
beforeLiElement,
|
52
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
53
|
+
afterLiElement,
|
54
|
+
'</ul>'))($rootScope);
|
55
|
+
elementBottom = $compile(''.concat(
|
56
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
57
|
+
beforeLiElement,
|
58
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
59
|
+
afterLiElement,
|
60
|
+
'</ul>'))($rootScope);
|
61
|
+
$rootScope.$apply(function() {
|
62
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
63
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
64
|
+
$rootScope.opts = { connectWith: '.cross-sortable' };
|
65
|
+
});
|
66
|
+
|
67
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
68
|
+
|
69
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
70
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
71
|
+
simulateElementDrag(li1, li2, 'below');
|
72
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
73
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
74
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
75
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
76
|
+
|
77
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
78
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
79
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
80
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
81
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
82
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
83
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
84
|
+
|
85
|
+
$(elementTop).remove();
|
86
|
+
$(elementBottom).remove();
|
87
|
+
});
|
88
|
+
});
|
89
|
+
|
90
|
+
it('should update model when sorting between sortables of different scopes', function() {
|
91
|
+
inject(function($compile, $rootScope) {
|
92
|
+
var elementTop, elementBottom,
|
93
|
+
wrapperTop, wrapperBottom,
|
94
|
+
wrapperTopScope, wrapperBottomScope,
|
95
|
+
itemsTop, itemsBottom;
|
96
|
+
wrapperTopScope = $rootScope.$new();
|
97
|
+
wrapperBottomScope = $rootScope.$new();
|
98
|
+
wrapperTop = $compile(''.concat(
|
99
|
+
'<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
100
|
+
beforeLiElement,
|
101
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
102
|
+
afterLiElement,
|
103
|
+
'</ul></div>'))(wrapperTopScope);
|
104
|
+
wrapperBottom = $compile(''.concat(
|
105
|
+
'<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
106
|
+
beforeLiElement,
|
107
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
108
|
+
afterLiElement,
|
109
|
+
'</ul></div>'))(wrapperBottomScope);
|
110
|
+
|
111
|
+
host.append(wrapperTop).append(wrapperBottom).append('<div class="clear"></div>');
|
112
|
+
$rootScope.$apply(function() {
|
113
|
+
wrapperTopScope.itemsTop = itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
114
|
+
wrapperBottomScope.itemsBottom = itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
115
|
+
$rootScope.opts = { connectWith: '.cross-sortable' };
|
116
|
+
});
|
117
|
+
|
118
|
+
elementTop = wrapperTop.find('> [ui-sortable]');
|
119
|
+
elementBottom = wrapperBottom.find('> [ui-sortable]');
|
120
|
+
|
121
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
122
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
123
|
+
simulateElementDrag(li1, li2, 'below');
|
124
|
+
expect(itemsTop).toEqual(['Top Two', 'Top Three']);
|
125
|
+
expect(itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
126
|
+
expect(itemsTop).toEqual(listContent(elementTop));
|
127
|
+
expect(itemsBottom).toEqual(listContent(elementBottom));
|
128
|
+
|
129
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
130
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
131
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
132
|
+
expect(itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
133
|
+
expect(itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
134
|
+
expect(itemsTop).toEqual(listContent(elementTop));
|
135
|
+
expect(itemsBottom).toEqual(listContent(elementBottom));
|
136
|
+
|
137
|
+
$(wrapperBottom).remove();
|
138
|
+
$(wrapperTop).remove();
|
139
|
+
});
|
140
|
+
});
|
141
|
+
|
142
|
+
it('should update model when sorting a "falsy" item between sortables', function() {
|
143
|
+
inject(function($compile, $rootScope) {
|
144
|
+
var elementTop, elementBottom;
|
145
|
+
elementTop = $compile(''.concat(
|
146
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
147
|
+
beforeLiElement,
|
148
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
149
|
+
afterLiElement,
|
150
|
+
'</ul>'))($rootScope);
|
151
|
+
elementBottom = $compile(''.concat(
|
152
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
153
|
+
beforeLiElement,
|
154
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
155
|
+
afterLiElement,
|
156
|
+
'</ul>'))($rootScope);
|
157
|
+
$rootScope.$apply(function() {
|
158
|
+
$rootScope.itemsTop = [0, 'Top Two', 'Top Three'];
|
159
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
160
|
+
$rootScope.opts = { connectWith: '.cross-sortable' };
|
161
|
+
});
|
162
|
+
|
163
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
164
|
+
|
165
|
+
function parseFalsyValue (value) {
|
166
|
+
if (value === '0') {
|
167
|
+
return 0;
|
168
|
+
}
|
169
|
+
return value;
|
170
|
+
}
|
171
|
+
|
172
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
173
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
174
|
+
simulateElementDrag(li1, li2, 'below');
|
175
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
176
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 0, 'Bottom Two', 'Bottom Three']);
|
177
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop).map(parseFalsyValue));
|
178
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom).map(parseFalsyValue));
|
179
|
+
|
180
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
181
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
182
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
183
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 0, 'Top Three']);
|
184
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
185
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop).map(parseFalsyValue));
|
186
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom).map(parseFalsyValue));
|
187
|
+
|
188
|
+
$(elementTop).remove();
|
189
|
+
$(elementBottom).remove();
|
190
|
+
});
|
191
|
+
});
|
192
|
+
|
193
|
+
it('should work when "placeholder" option is used', function() {
|
194
|
+
inject(function($compile, $rootScope) {
|
195
|
+
var elementTop, elementBottom;
|
196
|
+
elementTop = $compile(''.concat(
|
197
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
198
|
+
beforeLiElement,
|
199
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
200
|
+
afterLiElement,
|
201
|
+
'</ul>'))($rootScope);
|
202
|
+
elementBottom = $compile(''.concat(
|
203
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
204
|
+
beforeLiElement,
|
205
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
206
|
+
afterLiElement,
|
207
|
+
'</ul>'))($rootScope);
|
208
|
+
$rootScope.$apply(function() {
|
209
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
210
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
211
|
+
$rootScope.opts = {
|
212
|
+
placeholder: 'sortable-item-placeholder',
|
213
|
+
connectWith: '.cross-sortable'
|
214
|
+
};
|
215
|
+
});
|
216
|
+
|
217
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
218
|
+
|
219
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
220
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
221
|
+
simulateElementDrag(li1, li2, 'below');
|
222
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
223
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
224
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
225
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
226
|
+
|
227
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
228
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
229
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
230
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
231
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
232
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
233
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
234
|
+
|
235
|
+
$(elementTop).remove();
|
236
|
+
$(elementBottom).remove();
|
237
|
+
});
|
238
|
+
});
|
239
|
+
|
240
|
+
it('should work when "placeholder" option equals the class of items', function() {
|
241
|
+
inject(function($compile, $rootScope) {
|
242
|
+
var elementTop, elementBottom;
|
243
|
+
elementTop = $compile(''.concat(
|
244
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
245
|
+
beforeLiElement,
|
246
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
247
|
+
afterLiElement,
|
248
|
+
'</ul>'))($rootScope);
|
249
|
+
elementBottom = $compile(''.concat(
|
250
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
251
|
+
beforeLiElement,
|
252
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
253
|
+
afterLiElement,
|
254
|
+
'</ul>'))($rootScope);
|
255
|
+
$rootScope.$apply(function() {
|
256
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
257
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
258
|
+
$rootScope.opts = {
|
259
|
+
placeholder: 'sortable-item',
|
260
|
+
connectWith: '.cross-sortable'
|
261
|
+
};
|
262
|
+
});
|
263
|
+
|
264
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
265
|
+
|
266
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
267
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
268
|
+
simulateElementDrag(li1, li2, 'below');
|
269
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
270
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
271
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
272
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
273
|
+
|
274
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
275
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
276
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
277
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
278
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
279
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
280
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
281
|
+
|
282
|
+
$(elementTop).remove();
|
283
|
+
$(elementBottom).remove();
|
284
|
+
});
|
285
|
+
});
|
286
|
+
|
287
|
+
it('should work when "helper: clone" option is used', function() {
|
288
|
+
inject(function($compile, $rootScope) {
|
289
|
+
var elementTop, elementBottom;
|
290
|
+
elementTop = $compile(''.concat(
|
291
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
292
|
+
beforeLiElement,
|
293
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
294
|
+
afterLiElement,
|
295
|
+
'</ul>'))($rootScope);
|
296
|
+
elementBottom = $compile(''.concat(
|
297
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
298
|
+
beforeLiElement,
|
299
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
300
|
+
afterLiElement,
|
301
|
+
'</ul>'))($rootScope);
|
302
|
+
$rootScope.$apply(function() {
|
303
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
304
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
305
|
+
$rootScope.opts = {
|
306
|
+
helper: 'clone',
|
307
|
+
connectWith: '.cross-sortable'
|
308
|
+
};
|
309
|
+
});
|
310
|
+
|
311
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
312
|
+
|
313
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
314
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
315
|
+
simulateElementDrag(li1, li2, 'below');
|
316
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
317
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
318
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
319
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
320
|
+
|
321
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
322
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
323
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
324
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
325
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
326
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
327
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
328
|
+
|
329
|
+
$(elementTop).remove();
|
330
|
+
$(elementBottom).remove();
|
331
|
+
});
|
332
|
+
});
|
333
|
+
|
334
|
+
it('should work when "placeholder" and "helper: clone" options are used', function() {
|
335
|
+
inject(function($compile, $rootScope) {
|
336
|
+
var elementTop, elementBottom;
|
337
|
+
elementTop = $compile(''.concat(
|
338
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
339
|
+
beforeLiElement,
|
340
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
341
|
+
afterLiElement,
|
342
|
+
'</ul>'))($rootScope);
|
343
|
+
elementBottom = $compile(''.concat(
|
344
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
345
|
+
beforeLiElement,
|
346
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
347
|
+
afterLiElement,
|
348
|
+
'</ul>'))($rootScope);
|
349
|
+
$rootScope.$apply(function() {
|
350
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
351
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
352
|
+
$rootScope.opts = {
|
353
|
+
helper: 'clone',
|
354
|
+
placeholder: 'sortable-item-placeholder',
|
355
|
+
connectWith: '.cross-sortable'
|
356
|
+
};
|
357
|
+
});
|
358
|
+
|
359
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
360
|
+
|
361
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
362
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
363
|
+
simulateElementDrag(li1, li2, 'below');
|
364
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
365
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
366
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
367
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
368
|
+
|
369
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
370
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
371
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
372
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
373
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
374
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
375
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
376
|
+
|
377
|
+
$(elementTop).remove();
|
378
|
+
$(elementBottom).remove();
|
379
|
+
});
|
380
|
+
});
|
381
|
+
|
382
|
+
it('should work when "helper: function" option is used', function() {
|
383
|
+
inject(function($compile, $rootScope) {
|
384
|
+
var elementTop, elementBottom;
|
385
|
+
elementTop = $compile(''.concat(
|
386
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
387
|
+
beforeLiElement,
|
388
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
389
|
+
afterLiElement,
|
390
|
+
'</ul>'))($rootScope);
|
391
|
+
elementBottom = $compile(''.concat(
|
392
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
393
|
+
beforeLiElement,
|
394
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
395
|
+
afterLiElement,
|
396
|
+
'</ul>'))($rootScope);
|
397
|
+
$rootScope.$apply(function() {
|
398
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
399
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
400
|
+
$rootScope.opts = {
|
401
|
+
helper: function (e, item) {
|
402
|
+
return item.clone().text('helper');
|
403
|
+
},
|
404
|
+
connectWith: '.cross-sortable'
|
405
|
+
};
|
406
|
+
});
|
407
|
+
|
408
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
409
|
+
|
410
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
411
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
412
|
+
simulateElementDrag(li1, li2, 'below');
|
413
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
414
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
415
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
416
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
417
|
+
|
418
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
419
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
420
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
421
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
422
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
423
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
424
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
425
|
+
|
426
|
+
$(elementTop).remove();
|
427
|
+
$(elementBottom).remove();
|
428
|
+
});
|
429
|
+
});
|
430
|
+
|
431
|
+
it('should work when "placeholder" and "helper: function" options are used', function() {
|
432
|
+
inject(function($compile, $rootScope) {
|
433
|
+
var elementTop, elementBottom;
|
434
|
+
elementTop = $compile(''.concat(
|
435
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
436
|
+
beforeLiElement,
|
437
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
438
|
+
afterLiElement,
|
439
|
+
'</ul>'))($rootScope);
|
440
|
+
elementBottom = $compile(''.concat(
|
441
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
442
|
+
beforeLiElement,
|
443
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
444
|
+
afterLiElement,
|
445
|
+
'</ul>'))($rootScope);
|
446
|
+
$rootScope.$apply(function() {
|
447
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
448
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
449
|
+
$rootScope.opts = {
|
450
|
+
helper: function (e, item) {
|
451
|
+
return item.clone().text('helper');
|
452
|
+
},
|
453
|
+
placeholder: 'sortable-item-placeholder',
|
454
|
+
connectWith: '.cross-sortable'
|
455
|
+
};
|
456
|
+
});
|
457
|
+
|
458
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
459
|
+
|
460
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
461
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
462
|
+
simulateElementDrag(li1, li2, 'below');
|
463
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
464
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
465
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
466
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
467
|
+
|
468
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
469
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
470
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
471
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
472
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
473
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
474
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
475
|
+
|
476
|
+
$(elementTop).remove();
|
477
|
+
$(elementBottom).remove();
|
478
|
+
});
|
479
|
+
});
|
480
|
+
|
481
|
+
it('should work when "placeholder" and "helper: function" options are used and a drag is reverted', function() {
|
482
|
+
inject(function($compile, $rootScope) {
|
483
|
+
var elementTop, elementBottom;
|
484
|
+
elementTop = $compile(''.concat(
|
485
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
486
|
+
beforeLiElement,
|
487
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
488
|
+
afterLiElement,
|
489
|
+
'</ul>'))($rootScope);
|
490
|
+
elementBottom = $compile(''.concat(
|
491
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
492
|
+
beforeLiElement,
|
493
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
494
|
+
afterLiElement,
|
495
|
+
'</ul>'))($rootScope);
|
496
|
+
$rootScope.$apply(function() {
|
497
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
498
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
499
|
+
$rootScope.opts = {
|
500
|
+
helper: function (e, item) {
|
501
|
+
return item.clone().text('helper');
|
502
|
+
},
|
503
|
+
placeholder: 'sortable-item-placeholder',
|
504
|
+
connectWith: '.cross-sortable'
|
505
|
+
};
|
506
|
+
});
|
507
|
+
|
508
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
509
|
+
|
510
|
+
var li1 = elementTop.find('[ng-repeat]:eq(2)');
|
511
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(1)');
|
512
|
+
simulateElementDrag(li1, li2, { place: 'below', action: 'dragAndRevert' });
|
513
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
514
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
515
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
516
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
517
|
+
|
518
|
+
li1 = elementTop.find('[ng-repeat]:eq(0)');
|
519
|
+
li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
520
|
+
simulateElementDrag(li1, li2, 'below');
|
521
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
522
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
523
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
524
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
525
|
+
|
526
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
527
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
528
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
529
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
530
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
531
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
532
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
533
|
+
|
534
|
+
li1 = elementTop.find('[ng-repeat]:eq(2)');
|
535
|
+
li2 = elementBottom.find('[ng-repeat]:eq(1)');
|
536
|
+
simulateElementDrag(li1, li2, { place: 'below', extradx: -20, extrady: -11 });
|
537
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One']);
|
538
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Top Three', 'Bottom Three']);
|
539
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
540
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
541
|
+
|
542
|
+
$(elementTop).remove();
|
543
|
+
$(elementBottom).remove();
|
544
|
+
});
|
545
|
+
});
|
546
|
+
|
547
|
+
it('should work when "helper: function" that returns a list element is used', function() {
|
548
|
+
inject(function($compile, $rootScope) {
|
549
|
+
var elementTop, elementBottom;
|
550
|
+
elementTop = $compile(''.concat(
|
551
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
552
|
+
beforeLiElement,
|
553
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
554
|
+
afterLiElement,
|
555
|
+
'</ul>'))($rootScope);
|
556
|
+
elementBottom = $compile(''.concat(
|
557
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
558
|
+
beforeLiElement,
|
559
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
560
|
+
afterLiElement,
|
561
|
+
'</ul>'))($rootScope);
|
562
|
+
$rootScope.$apply(function() {
|
563
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
564
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
565
|
+
$rootScope.opts = {
|
566
|
+
helper: function (e, item) {
|
567
|
+
return item;
|
568
|
+
},
|
569
|
+
connectWith: '.cross-sortable'
|
570
|
+
};
|
571
|
+
});
|
572
|
+
|
573
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
574
|
+
|
575
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
576
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
577
|
+
simulateElementDrag(li1, li2, 'below');
|
578
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
579
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
580
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
581
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
582
|
+
|
583
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
584
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
585
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
586
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
587
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
588
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
589
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
590
|
+
|
591
|
+
$(elementTop).remove();
|
592
|
+
$(elementBottom).remove();
|
593
|
+
});
|
594
|
+
});
|
595
|
+
|
596
|
+
it('should work when "placeholder" and "helper: function" that returns a list element are used', function() {
|
597
|
+
inject(function($compile, $rootScope) {
|
598
|
+
var elementTop, elementBottom;
|
599
|
+
elementTop = $compile(''.concat(
|
600
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
601
|
+
beforeLiElement,
|
602
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}" class="sortable-item">{{ item }}</li>',
|
603
|
+
afterLiElement,
|
604
|
+
'</ul>'))($rootScope);
|
605
|
+
elementBottom = $compile(''.concat(
|
606
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
607
|
+
beforeLiElement,
|
608
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}" class="sortable-item">{{ item }}</li>',
|
609
|
+
afterLiElement,
|
610
|
+
'</ul>'))($rootScope);
|
611
|
+
$rootScope.$apply(function() {
|
612
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
613
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
614
|
+
$rootScope.opts = {
|
615
|
+
helper: function (e, item) {
|
616
|
+
return item;
|
617
|
+
},
|
618
|
+
placeholder: 'sortable-item-placeholder',
|
619
|
+
connectWith: '.cross-sortable'
|
620
|
+
};
|
621
|
+
});
|
622
|
+
|
623
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
624
|
+
|
625
|
+
var li1 = elementTop.find('[ng-repeat]:eq(0)');
|
626
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
627
|
+
simulateElementDrag(li1, li2, 'below');
|
628
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
629
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
630
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
631
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
632
|
+
|
633
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
634
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
635
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
636
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
637
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
638
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
639
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
640
|
+
|
641
|
+
$(elementTop).remove();
|
642
|
+
$(elementBottom).remove();
|
643
|
+
});
|
644
|
+
});
|
645
|
+
|
646
|
+
it('should cancel sorting of nodes that contain "Two"', function() {
|
647
|
+
inject(function($compile, $rootScope) {
|
648
|
+
var elementTop, elementBottom;
|
649
|
+
elementTop = $compile(''.concat(
|
650
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
651
|
+
beforeLiElement,
|
652
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
653
|
+
afterLiElement,
|
654
|
+
'</ul>'))($rootScope);
|
655
|
+
elementBottom = $compile(''.concat(
|
656
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
657
|
+
beforeLiElement,
|
658
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
659
|
+
afterLiElement,
|
660
|
+
'</ul>'))($rootScope);
|
661
|
+
$rootScope.$apply(function() {
|
662
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
663
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
664
|
+
$rootScope.opts = {
|
665
|
+
connectWith: '.cross-sortable',
|
666
|
+
update: function(e, ui) {
|
667
|
+
if (ui.item.sortable.model &&
|
668
|
+
(typeof ui.item.sortable.model === 'string') &&
|
669
|
+
ui.item.sortable.model.indexOf('Two') >= 0) {
|
670
|
+
ui.item.sortable.cancel();
|
671
|
+
}
|
672
|
+
}
|
673
|
+
};
|
674
|
+
});
|
675
|
+
|
676
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
677
|
+
|
678
|
+
var li1 = elementTop.find('[ng-repeat]:eq(1)');
|
679
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
680
|
+
simulateElementDrag(li1, li2, 'below');
|
681
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
682
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
683
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
684
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
685
|
+
|
686
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
687
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
688
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
689
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
690
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
691
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
692
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
693
|
+
|
694
|
+
li1 = elementTop.find('[ng-repeat]:eq(0)');
|
695
|
+
li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
696
|
+
simulateElementDrag(li1, li2, 'below');
|
697
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
698
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
699
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
700
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
701
|
+
|
702
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
703
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
704
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
705
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
706
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
707
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
708
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
709
|
+
|
710
|
+
$(elementTop).remove();
|
711
|
+
$(elementBottom).remove();
|
712
|
+
});
|
713
|
+
});
|
714
|
+
|
715
|
+
it('should properly set ui.item.sortable properties', function() {
|
716
|
+
inject(function($compile, $rootScope) {
|
717
|
+
var elementTop, elementBottom, updateCallbackExpectations, stopCallbackExpectations;
|
718
|
+
elementTop = $compile(''.concat(
|
719
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
720
|
+
beforeLiElement,
|
721
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
722
|
+
afterLiElement,
|
723
|
+
'</ul>'))($rootScope);
|
724
|
+
elementBottom = $compile(''.concat(
|
725
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
726
|
+
beforeLiElement,
|
727
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
728
|
+
afterLiElement,
|
729
|
+
'</ul>'))($rootScope);
|
730
|
+
$rootScope.$apply(function() {
|
731
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
732
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
733
|
+
$rootScope.opts = {
|
734
|
+
connectWith: '.cross-sortable',
|
735
|
+
update: function(e, ui) {
|
736
|
+
if (ui.item.sortable.model &&
|
737
|
+
(typeof ui.item.sortable.model === 'string') &&
|
738
|
+
ui.item.sortable.model.indexOf('Two') >= 0) {
|
739
|
+
ui.item.sortable.cancel();
|
740
|
+
}
|
741
|
+
updateCallbackExpectations(ui.item.sortable);
|
742
|
+
},
|
743
|
+
stop: function(e, ui) {
|
744
|
+
stopCallbackExpectations(ui.item.sortable);
|
745
|
+
}
|
746
|
+
};
|
747
|
+
});
|
748
|
+
|
749
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
750
|
+
|
751
|
+
var li1 = elementTop.find('[ng-repeat]:eq(1)');
|
752
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
753
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
754
|
+
expect(uiItemSortable.model).toEqual('Top Two');
|
755
|
+
expect(uiItemSortable.index).toEqual(1);
|
756
|
+
expect(uiItemSortable.source.length).toEqual(1);
|
757
|
+
expect(uiItemSortable.source[0]).toBe(host.children()[0]);
|
758
|
+
expect(uiItemSortable.sourceModel).toBe($rootScope.itemsTop);
|
759
|
+
expect(uiItemSortable.isCanceled()).toBe(true);
|
760
|
+
expect(uiItemSortable.isCustomHelperUsed()).toBe(false);
|
761
|
+
|
762
|
+
expect(uiItemSortable.dropindex).toEqual(1);
|
763
|
+
expect(uiItemSortable.droptarget.length).toBe(1);
|
764
|
+
expect(uiItemSortable.droptarget[0]).toBe(host.children()[1]);
|
765
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsBottom);
|
766
|
+
};
|
767
|
+
stopCallbackExpectations = function(uiItemSortable) {
|
768
|
+
expect(uiItemSortable.received).toBe(true);
|
769
|
+
expect(uiItemSortable.moved).toBe(undefined);
|
770
|
+
};
|
771
|
+
simulateElementDrag(li1, li2, { place: 'below', extradx: -20, extrady: -11 });
|
772
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
773
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
774
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
775
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
776
|
+
updateCallbackExpectations = stopCallbackExpectations = undefined;
|
777
|
+
|
778
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
779
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
780
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
781
|
+
expect(uiItemSortable.model).toEqual('Bottom Two');
|
782
|
+
expect(uiItemSortable.index).toEqual(1);
|
783
|
+
expect(uiItemSortable.source.length).toEqual(1);
|
784
|
+
expect(uiItemSortable.source[0]).toBe(host.children()[1]);
|
785
|
+
expect(uiItemSortable.sourceModel).toBe($rootScope.itemsBottom);
|
786
|
+
expect(uiItemSortable.isCanceled()).toBe(true);
|
787
|
+
expect(uiItemSortable.isCustomHelperUsed()).toBe(false);
|
788
|
+
|
789
|
+
expect(uiItemSortable.dropindex).toEqual(1);
|
790
|
+
expect(uiItemSortable.droptarget.length).toBe(1);
|
791
|
+
expect(uiItemSortable.droptarget[0]).toBe(host.children()[0]);
|
792
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsTop);
|
793
|
+
};
|
794
|
+
stopCallbackExpectations = function(uiItemSortable) {
|
795
|
+
expect(uiItemSortable.received).toBe(true);
|
796
|
+
expect(uiItemSortable.moved).toBe(undefined);
|
797
|
+
};
|
798
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
799
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
800
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
801
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
802
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
803
|
+
updateCallbackExpectations = stopCallbackExpectations = undefined;
|
804
|
+
|
805
|
+
li1 = elementTop.find('[ng-repeat]:eq(0)');
|
806
|
+
li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
807
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
808
|
+
expect(uiItemSortable.model).toEqual('Top One');
|
809
|
+
expect(uiItemSortable.index).toEqual(0);
|
810
|
+
expect(uiItemSortable.source.length).toEqual(1);
|
811
|
+
expect(uiItemSortable.source[0]).toBe(host.children()[0]);
|
812
|
+
expect(uiItemSortable.sourceModel).toBe($rootScope.itemsTop);
|
813
|
+
expect(uiItemSortable.isCanceled()).toBe(false);
|
814
|
+
expect(uiItemSortable.isCustomHelperUsed()).toBe(false);
|
815
|
+
|
816
|
+
expect(uiItemSortable.dropindex).toEqual(1);
|
817
|
+
expect(uiItemSortable.droptarget.length).toBe(1);
|
818
|
+
expect(uiItemSortable.droptarget[0]).toBe(host.children()[1]);
|
819
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsBottom);
|
820
|
+
};
|
821
|
+
stopCallbackExpectations = function(uiItemSortable) {
|
822
|
+
expect(uiItemSortable.received).toBe(true);
|
823
|
+
expect(uiItemSortable.moved).toBe('Top One');
|
824
|
+
};
|
825
|
+
simulateElementDrag(li1, li2, 'below');
|
826
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
827
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
828
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
829
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
830
|
+
updateCallbackExpectations = stopCallbackExpectations = undefined;
|
831
|
+
|
832
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
833
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
834
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
835
|
+
expect(uiItemSortable.model).toEqual('Top One');
|
836
|
+
expect(uiItemSortable.index).toEqual(1);
|
837
|
+
expect(uiItemSortable.source.length).toEqual(1);
|
838
|
+
expect(uiItemSortable.source[0]).toBe(host.children()[1]);
|
839
|
+
expect(uiItemSortable.sourceModel).toBe($rootScope.itemsBottom);
|
840
|
+
expect(uiItemSortable.isCanceled()).toBe(false);
|
841
|
+
expect(uiItemSortable.isCustomHelperUsed()).toBe(false);
|
842
|
+
|
843
|
+
expect(uiItemSortable.dropindex).toEqual(1);
|
844
|
+
expect(uiItemSortable.droptarget.length).toBe(1);
|
845
|
+
expect(uiItemSortable.droptarget[0]).toBe(host.children()[0]);
|
846
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsTop);
|
847
|
+
};
|
848
|
+
stopCallbackExpectations = function(uiItemSortable) {
|
849
|
+
expect(uiItemSortable.received).toBe(true);
|
850
|
+
expect(uiItemSortable.moved).toBe('Top One');
|
851
|
+
};
|
852
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
853
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
854
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
855
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
856
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
857
|
+
updateCallbackExpectations = stopCallbackExpectations = undefined;
|
858
|
+
|
859
|
+
$(elementTop).remove();
|
860
|
+
$(elementBottom).remove();
|
861
|
+
});
|
862
|
+
});
|
863
|
+
|
864
|
+
it('should properly set ui.item.sortable.droptargetModel when using data-ng-model', function() {
|
865
|
+
inject(function($compile, $rootScope) {
|
866
|
+
var elementTop, elementBottom, updateCallbackExpectations;
|
867
|
+
elementTop = $compile(''.concat(
|
868
|
+
'<ul ui-sortable="opts" class="cross-sortable" data-ng-model="itemsTop">',
|
869
|
+
beforeLiElement,
|
870
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
871
|
+
afterLiElement,
|
872
|
+
'</ul>'))($rootScope);
|
873
|
+
elementBottom = $compile(''.concat(
|
874
|
+
'<ul ui-sortable="opts" class="cross-sortable" data-ng-model="itemsBottom">',
|
875
|
+
beforeLiElement,
|
876
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
877
|
+
afterLiElement,
|
878
|
+
'</ul>'))($rootScope);
|
879
|
+
$rootScope.$apply(function() {
|
880
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
881
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
882
|
+
$rootScope.opts = {
|
883
|
+
connectWith: '.cross-sortable',
|
884
|
+
update: function(e, ui) {
|
885
|
+
if (ui.item.sortable.model &&
|
886
|
+
(typeof ui.item.sortable.model === 'string') &&
|
887
|
+
ui.item.sortable.model.indexOf('Two') >= 0) {
|
888
|
+
ui.item.sortable.cancel();
|
889
|
+
}
|
890
|
+
updateCallbackExpectations(ui.item.sortable);
|
891
|
+
}
|
892
|
+
};
|
893
|
+
});
|
894
|
+
|
895
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
896
|
+
|
897
|
+
var li1 = elementTop.find('[ng-repeat]:eq(1)');
|
898
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
899
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
900
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsBottom);
|
901
|
+
};
|
902
|
+
simulateElementDrag(li1, li2, { place: 'below', extradx: -20, extrady: -11 });
|
903
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
904
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
905
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
906
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
907
|
+
updateCallbackExpectations = undefined;
|
908
|
+
|
909
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
910
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
911
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
912
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsTop);
|
913
|
+
};
|
914
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
915
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
916
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
917
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
918
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
919
|
+
updateCallbackExpectations = undefined;
|
920
|
+
|
921
|
+
li1 = elementTop.find('[ng-repeat]:eq(0)');
|
922
|
+
li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
923
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
924
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsBottom);
|
925
|
+
};
|
926
|
+
simulateElementDrag(li1, li2, 'below');
|
927
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
928
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
929
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
930
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
931
|
+
updateCallbackExpectations = undefined;
|
932
|
+
|
933
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
934
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
935
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
936
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsTop);
|
937
|
+
};
|
938
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
939
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
940
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
941
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
942
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
943
|
+
updateCallbackExpectations = undefined;
|
944
|
+
|
945
|
+
$(elementTop).remove();
|
946
|
+
$(elementBottom).remove();
|
947
|
+
});
|
948
|
+
});
|
949
|
+
|
950
|
+
it('should properly set ui.item.sortable.droptargetModel when using data-ui-sortable', function() {
|
951
|
+
inject(function($compile, $rootScope) {
|
952
|
+
var elementTop, elementBottom, updateCallbackExpectations;
|
953
|
+
elementTop = $compile(''.concat(
|
954
|
+
'<ul data-ui-sortable="opts" class="cross-sortable" data-ng-model="itemsTop">',
|
955
|
+
beforeLiElement,
|
956
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
957
|
+
afterLiElement,
|
958
|
+
'</ul>'))($rootScope);
|
959
|
+
elementBottom = $compile(''.concat(
|
960
|
+
'<ul data-ui-sortable="opts" class="cross-sortable" data-ng-model="itemsBottom">',
|
961
|
+
beforeLiElement,
|
962
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
963
|
+
afterLiElement,
|
964
|
+
'</ul>'))($rootScope);
|
965
|
+
$rootScope.$apply(function() {
|
966
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
967
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
968
|
+
$rootScope.opts = {
|
969
|
+
connectWith: '.cross-sortable',
|
970
|
+
update: function(e, ui) {
|
971
|
+
if (ui.item.sortable.model &&
|
972
|
+
(typeof ui.item.sortable.model === 'string') &&
|
973
|
+
ui.item.sortable.model.indexOf('Two') >= 0) {
|
974
|
+
ui.item.sortable.cancel();
|
975
|
+
}
|
976
|
+
updateCallbackExpectations(ui.item.sortable);
|
977
|
+
}
|
978
|
+
};
|
979
|
+
});
|
980
|
+
|
981
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
982
|
+
|
983
|
+
var li1 = elementTop.find('[ng-repeat]:eq(1)');
|
984
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
985
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
986
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsBottom);
|
987
|
+
};
|
988
|
+
simulateElementDrag(li1, li2, { place: 'below', extradx: -20, extrady: -11 });
|
989
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
990
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
991
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
992
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
993
|
+
updateCallbackExpectations = undefined;
|
994
|
+
|
995
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
996
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
997
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
998
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsTop);
|
999
|
+
};
|
1000
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
1001
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
1002
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
1003
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
1004
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
1005
|
+
updateCallbackExpectations = undefined;
|
1006
|
+
|
1007
|
+
li1 = elementTop.find('[ng-repeat]:eq(0)');
|
1008
|
+
li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
1009
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
1010
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsBottom);
|
1011
|
+
};
|
1012
|
+
simulateElementDrag(li1, li2, 'below');
|
1013
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
1014
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
1015
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
1016
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
1017
|
+
updateCallbackExpectations = undefined;
|
1018
|
+
|
1019
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
1020
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
1021
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
1022
|
+
expect(uiItemSortable.droptargetModel).toBe($rootScope.itemsTop);
|
1023
|
+
};
|
1024
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
1025
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
1026
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
1027
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
1028
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
1029
|
+
updateCallbackExpectations = undefined;
|
1030
|
+
|
1031
|
+
$(elementTop).remove();
|
1032
|
+
$(elementBottom).remove();
|
1033
|
+
});
|
1034
|
+
});
|
1035
|
+
|
1036
|
+
it('should properly set ui.item.sortable.droptargetModel when sorting between different scopes', function() {
|
1037
|
+
inject(function($compile, $rootScope) {
|
1038
|
+
var elementTop, elementBottom,
|
1039
|
+
wrapperTop, wrapperBottom,
|
1040
|
+
wrapperTopScope, wrapperBottomScope,
|
1041
|
+
itemsTop, itemsBottom,
|
1042
|
+
updateCallbackExpectations;
|
1043
|
+
wrapperTopScope = $rootScope.$new();
|
1044
|
+
wrapperBottomScope = $rootScope.$new();
|
1045
|
+
wrapperTop = $compile(''.concat(
|
1046
|
+
'<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
1047
|
+
beforeLiElement,
|
1048
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
1049
|
+
afterLiElement,
|
1050
|
+
'</ul></div>'))(wrapperTopScope);
|
1051
|
+
wrapperBottom = $compile(''.concat(
|
1052
|
+
'<div ng-controller="dummyController"><ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
1053
|
+
beforeLiElement,
|
1054
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
1055
|
+
afterLiElement,
|
1056
|
+
'</ul></div>'))(wrapperBottomScope);
|
1057
|
+
|
1058
|
+
host.append(wrapperTop).append(wrapperBottom).append('<div class="clear"></div>');
|
1059
|
+
$rootScope.$apply(function() {
|
1060
|
+
wrapperTopScope.itemsTop = itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
1061
|
+
wrapperBottomScope.itemsBottom = itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
1062
|
+
$rootScope.opts = {
|
1063
|
+
connectWith: '.cross-sortable',
|
1064
|
+
update: function(e, ui) {
|
1065
|
+
if (ui.item.sortable.model &&
|
1066
|
+
(typeof ui.item.sortable.model === 'string') &&
|
1067
|
+
ui.item.sortable.model.indexOf('Two') >= 0) {
|
1068
|
+
ui.item.sortable.cancel();
|
1069
|
+
}
|
1070
|
+
updateCallbackExpectations(ui.item.sortable);
|
1071
|
+
}
|
1072
|
+
};
|
1073
|
+
});
|
1074
|
+
|
1075
|
+
elementTop = wrapperTop.find('> [ui-sortable]');
|
1076
|
+
elementBottom = wrapperBottom.find('> [ui-sortable]');
|
1077
|
+
|
1078
|
+
var li1 = elementTop.find('[ng-repeat]:eq(1)');
|
1079
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
1080
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
1081
|
+
expect(uiItemSortable.droptargetModel).toBe(itemsBottom);
|
1082
|
+
};
|
1083
|
+
simulateElementDrag(li1, li2, { place: 'below', extradx: -20, extrady: -11 });
|
1084
|
+
expect(itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
1085
|
+
expect(itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
1086
|
+
expect(itemsTop).toEqual(listContent(elementTop));
|
1087
|
+
expect(itemsBottom).toEqual(listContent(elementBottom));
|
1088
|
+
updateCallbackExpectations = undefined;
|
1089
|
+
|
1090
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
1091
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
1092
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
1093
|
+
expect(uiItemSortable.droptargetModel).toBe(itemsTop);
|
1094
|
+
};
|
1095
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
1096
|
+
expect(itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
1097
|
+
expect(itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
1098
|
+
expect(itemsTop).toEqual(listContent(elementTop));
|
1099
|
+
expect(itemsBottom).toEqual(listContent(elementBottom));
|
1100
|
+
updateCallbackExpectations = undefined;
|
1101
|
+
|
1102
|
+
li1 = elementTop.find('[ng-repeat]:eq(0)');
|
1103
|
+
li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
1104
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
1105
|
+
expect(uiItemSortable.droptargetModel).toBe(itemsBottom);
|
1106
|
+
};
|
1107
|
+
simulateElementDrag(li1, li2, 'below');
|
1108
|
+
expect(itemsTop).toEqual(['Top Two', 'Top Three']);
|
1109
|
+
expect(itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
1110
|
+
expect(itemsTop).toEqual(listContent(elementTop));
|
1111
|
+
expect(itemsBottom).toEqual(listContent(elementBottom));
|
1112
|
+
updateCallbackExpectations = undefined;
|
1113
|
+
|
1114
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
1115
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
1116
|
+
updateCallbackExpectations = function(uiItemSortable) {
|
1117
|
+
expect(uiItemSortable.droptargetModel).toBe(itemsTop);
|
1118
|
+
};
|
1119
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
1120
|
+
expect(itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
1121
|
+
expect(itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
1122
|
+
expect(itemsTop).toEqual(listContent(elementTop));
|
1123
|
+
expect(itemsBottom).toEqual(listContent(elementBottom));
|
1124
|
+
updateCallbackExpectations = undefined;
|
1125
|
+
|
1126
|
+
$(wrapperTop).remove();
|
1127
|
+
$(wrapperBottom).remove();
|
1128
|
+
});
|
1129
|
+
});
|
1130
|
+
|
1131
|
+
it('should properly free ui.item.sortable object', function() {
|
1132
|
+
inject(function($compile, $rootScope) {
|
1133
|
+
var elementTop, elementBottom, uiItem, uiItemSortable_Destroy;
|
1134
|
+
elementTop = $compile(''.concat(
|
1135
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsTop">',
|
1136
|
+
beforeLiElement,
|
1137
|
+
'<li ng-repeat="item in itemsTop" id="s-top-{{$index}}">{{ item }}</li>',
|
1138
|
+
afterLiElement,
|
1139
|
+
'</ul>'))($rootScope);
|
1140
|
+
elementBottom = $compile(''.concat(
|
1141
|
+
'<ul ui-sortable="opts" class="cross-sortable" ng-model="itemsBottom">',
|
1142
|
+
beforeLiElement,
|
1143
|
+
'<li ng-repeat="item in itemsBottom" id="s-bottom-{{$index}}">{{ item }}</li>',
|
1144
|
+
afterLiElement,
|
1145
|
+
'</ul>'))($rootScope);
|
1146
|
+
$rootScope.$apply(function() {
|
1147
|
+
$rootScope.itemsTop = ['Top One', 'Top Two', 'Top Three'];
|
1148
|
+
$rootScope.itemsBottom = ['Bottom One', 'Bottom Two', 'Bottom Three'];
|
1149
|
+
$rootScope.opts = {
|
1150
|
+
connectWith: '.cross-sortable',
|
1151
|
+
start: function (e, ui) {
|
1152
|
+
uiItem = ui.item;
|
1153
|
+
spyOn(ui.item.sortable, '_destroy').and.callThrough();
|
1154
|
+
uiItemSortable_Destroy = ui.item.sortable._destroy;
|
1155
|
+
},
|
1156
|
+
update: function(e, ui) {
|
1157
|
+
uiItem.sortable = ui.item.sortable;
|
1158
|
+
if (ui.item.sortable.model &&
|
1159
|
+
(typeof ui.item.sortable.model === 'string') &&
|
1160
|
+
ui.item.sortable.model.indexOf('Two') >= 0) {
|
1161
|
+
ui.item.sortable.cancel();
|
1162
|
+
}
|
1163
|
+
}
|
1164
|
+
};
|
1165
|
+
});
|
1166
|
+
|
1167
|
+
host.append(elementTop).append(elementBottom).append('<div class="clear"></div>');
|
1168
|
+
|
1169
|
+
var li1 = elementTop.find('[ng-repeat]:eq(1)');
|
1170
|
+
var li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
1171
|
+
simulateElementDrag(li1, li2, 'below');
|
1172
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
1173
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
1174
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
1175
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
1176
|
+
expect(uiItemSortable_Destroy).toHaveBeenCalled();
|
1177
|
+
expect(hasUndefinedProperties(uiItem.sortable)).toBe(true);
|
1178
|
+
uiItem = uiItemSortable_Destroy = undefined;
|
1179
|
+
|
1180
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
1181
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
1182
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
1183
|
+
expect($rootScope.itemsTop).toEqual(['Top One', 'Top Two', 'Top Three']);
|
1184
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
1185
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
1186
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
1187
|
+
expect(uiItemSortable_Destroy).toHaveBeenCalled();
|
1188
|
+
expect(hasUndefinedProperties(uiItem.sortable)).toBe(true);
|
1189
|
+
uiItem = uiItemSortable_Destroy = undefined;
|
1190
|
+
|
1191
|
+
li1 = elementTop.find('[ng-repeat]:eq(0)');
|
1192
|
+
li2 = elementBottom.find('[ng-repeat]:eq(0)');
|
1193
|
+
simulateElementDrag(li1, li2, 'below');
|
1194
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top Three']);
|
1195
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Top One', 'Bottom Two', 'Bottom Three']);
|
1196
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
1197
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
1198
|
+
expect(uiItemSortable_Destroy).toHaveBeenCalled();
|
1199
|
+
expect(hasUndefinedProperties(uiItem.sortable)).toBe(true);
|
1200
|
+
uiItem = uiItemSortable_Destroy = undefined;
|
1201
|
+
|
1202
|
+
li1 = elementBottom.find('[ng-repeat]:eq(1)');
|
1203
|
+
li2 = elementTop.find('[ng-repeat]:eq(1)');
|
1204
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -20, extrady: -11 });
|
1205
|
+
expect($rootScope.itemsTop).toEqual(['Top Two', 'Top One', 'Top Three']);
|
1206
|
+
expect($rootScope.itemsBottom).toEqual(['Bottom One', 'Bottom Two', 'Bottom Three']);
|
1207
|
+
expect($rootScope.itemsTop).toEqual(listContent(elementTop));
|
1208
|
+
expect($rootScope.itemsBottom).toEqual(listContent(elementBottom));
|
1209
|
+
expect(uiItemSortable_Destroy).toHaveBeenCalled();
|
1210
|
+
expect(hasUndefinedProperties(uiItem.sortable)).toBe(true);
|
1211
|
+
uiItem = uiItemSortable_Destroy = undefined;
|
1212
|
+
|
1213
|
+
$(elementTop).remove();
|
1214
|
+
$(elementBottom).remove();
|
1215
|
+
});
|
1216
|
+
});
|
1217
|
+
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
[0, 1].forEach(function(useExtraElements){
|
1221
|
+
var testDescription = tests.description;
|
1222
|
+
|
1223
|
+
if (useExtraElements) {
|
1224
|
+
testDescription += ' with extra elements';
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
describe(testDescription, function(){
|
1228
|
+
tests(useExtraElements);
|
1229
|
+
});
|
1230
|
+
});
|
1231
|
+
|
1232
|
+
});
|