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,186 @@
|
|
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, listInnerContent, simulateElementDrag;
|
16
|
+
|
17
|
+
beforeEach(inject(function (sortableTestHelper) {
|
18
|
+
EXTRA_DY_PERCENTAGE = sortableTestHelper.EXTRA_DY_PERCENTAGE;
|
19
|
+
listInnerContent = sortableTestHelper.listInnerContent;
|
20
|
+
simulateElementDrag = sortableTestHelper.simulateElementDrag;
|
21
|
+
}));
|
22
|
+
|
23
|
+
describe('Nested sortables related', function() {
|
24
|
+
|
25
|
+
var host;
|
26
|
+
|
27
|
+
beforeEach(inject(function() {
|
28
|
+
host = $('<div id="test-host"></div>');
|
29
|
+
$('body').append(host);
|
30
|
+
}));
|
31
|
+
|
32
|
+
afterEach(function() {
|
33
|
+
host.remove();
|
34
|
+
host = null;
|
35
|
+
});
|
36
|
+
|
37
|
+
it('should update model when sorting between nested sortables', function() {
|
38
|
+
inject(function($compile, $rootScope) {
|
39
|
+
var elementTree, li1, li2;
|
40
|
+
|
41
|
+
elementTree = $compile(''.concat(
|
42
|
+
'<ul ui-sortable="sortableOptions" ng-model="items" class="nested-sortable outterList" style="float: left;margin-left: 10px;padding-bottom: 10px;">',
|
43
|
+
'<li ng-repeat="item in items">',
|
44
|
+
'<div>',
|
45
|
+
'<span class="itemContent lvl1ItemContent">{{item.text}}</span>',
|
46
|
+
'<ul ui-sortable="sortableOptions" ng-model="item.items" class="nested-sortable innerList" style="margin-left: 10px;padding-bottom: 10px;">',
|
47
|
+
'<li ng-repeat="i in item.items">',
|
48
|
+
'<span class="itemContent lvl2ItemContent">{{i.text}}</span>',
|
49
|
+
'</li>',
|
50
|
+
'</ul>',
|
51
|
+
'</div>',
|
52
|
+
'</li>',
|
53
|
+
'</ul>',
|
54
|
+
'<div style="clear: both;"></div>'))($rootScope);
|
55
|
+
|
56
|
+
$rootScope.$apply(function() {
|
57
|
+
$rootScope.items = [
|
58
|
+
{
|
59
|
+
text: 'Item 1',
|
60
|
+
items: []
|
61
|
+
},
|
62
|
+
{
|
63
|
+
text: 'Item 2',
|
64
|
+
items: [
|
65
|
+
{ text: 'Item 2.1', items: [] },
|
66
|
+
{ text: 'Item 2.2', items: [] }
|
67
|
+
]
|
68
|
+
}
|
69
|
+
];
|
70
|
+
|
71
|
+
$rootScope.sortableOptions = {
|
72
|
+
connectWith: '.nested-sortable'
|
73
|
+
};
|
74
|
+
});
|
75
|
+
|
76
|
+
host.append(elementTree);
|
77
|
+
|
78
|
+
// this should drag the item out of the list and
|
79
|
+
// the item should return back to its original position
|
80
|
+
li1 = elementTree.find('.innerList:last').find('li:last');
|
81
|
+
li1.simulate('drag', { dx: -200, moves: 30 });
|
82
|
+
expect($rootScope.items.map(function(x){ return x.text; }))
|
83
|
+
.toEqual(['Item 1', 'Item 2']);
|
84
|
+
expect($rootScope.items.map(function(x){ return x.text; }))
|
85
|
+
.toEqual(listInnerContent(elementTree, '.lvl1ItemContent'));
|
86
|
+
expect($rootScope.items[0].items.map(function(x){ return x.text; }))
|
87
|
+
.toEqual([]);
|
88
|
+
expect($rootScope.items[0].items.map(function(x){ return x.text; }))
|
89
|
+
.toEqual(listInnerContent(elementTree.find('.innerList:eq(0)'), '.lvl2ItemContent'));
|
90
|
+
expect($rootScope.items[1].items.map(function(x){ return x.text; }))
|
91
|
+
.toEqual(['Item 2.1', 'Item 2.2']);
|
92
|
+
expect($rootScope.items[1].items.map(function(x){ return x.text; }))
|
93
|
+
.toEqual(listInnerContent(elementTree.find('.innerList:eq(1)'), '.lvl2ItemContent'));
|
94
|
+
|
95
|
+
// this should drag the item from the outter list and
|
96
|
+
// drop it to the inner list
|
97
|
+
li1 = elementTree.find('> li:first');
|
98
|
+
li2 = elementTree.find('.innerList:last').find('li:last');
|
99
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: 10, extrady: -5 });
|
100
|
+
expect($rootScope.items.map(function(x){ return x.text; }))
|
101
|
+
.toEqual(['Item 2']);
|
102
|
+
expect($rootScope.items.map(function(x){ return x.text; }))
|
103
|
+
.toEqual(listInnerContent(elementTree, '.lvl1ItemContent'));
|
104
|
+
expect($rootScope.items[0].items.map(function(x){ return x.text; }))
|
105
|
+
.toEqual(['Item 2.1', 'Item 1', 'Item 2.2']);
|
106
|
+
expect($rootScope.items[0].items.map(function(x){ return x.text; }))
|
107
|
+
.toEqual(listInnerContent(elementTree.find('.innerList:eq(0)'), '.lvl2ItemContent'));
|
108
|
+
|
109
|
+
// this should drag the item from the inner list and
|
110
|
+
// drop it to the outter list
|
111
|
+
li1 = elementTree.find('.innerList:last').find('li:last');
|
112
|
+
li2 = elementTree.find('> li:first');
|
113
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -10, extrady: -6 });
|
114
|
+
expect($rootScope.items.map(function(x){ return x.text; }))
|
115
|
+
.toEqual(['Item 2.2', 'Item 2']);
|
116
|
+
expect($rootScope.items.map(function(x){ return x.text; }))
|
117
|
+
.toEqual(listInnerContent(elementTree, '.lvl1ItemContent'));
|
118
|
+
expect($rootScope.items[0].items.map(function(x){ return x.text; }))
|
119
|
+
.toEqual([]);
|
120
|
+
expect($rootScope.items[0].items.map(function(x){ return x.text; }))
|
121
|
+
.toEqual(listInnerContent(elementTree.find('.innerList:eq(0)'), '.lvl2ItemContent'));
|
122
|
+
expect($rootScope.items[1].items.map(function(x){ return x.text; }))
|
123
|
+
.toEqual(['Item 2.1', 'Item 1']);
|
124
|
+
expect($rootScope.items[1].items.map(function(x){ return x.text; }))
|
125
|
+
.toEqual(listInnerContent(elementTree.find('.innerList:eq(1)'), '.lvl2ItemContent'));
|
126
|
+
|
127
|
+
$(elementTree).remove();
|
128
|
+
});
|
129
|
+
});
|
130
|
+
|
131
|
+
it('should update model when sorting between drectly nested sortables', function() {
|
132
|
+
inject(function($compile, $rootScope) {
|
133
|
+
var elementTree, li1, li2;
|
134
|
+
|
135
|
+
elementTree = $compile(''.concat(
|
136
|
+
'<div ui-sortable="sortableOptions" ng-model="items" class="nested-sortable outterList" style="float: left;margin-left: 10px;padding-bottom: 10px;">',
|
137
|
+
'<div ui-sortable="innerSortableOptions" ng-model="item.items" class="nested-sortable innerList" ng-repeat="item in items">',
|
138
|
+
'<div class="itemContent lvl1ItemContent">{{item.text}}</div>',
|
139
|
+
'<div ng-repeat="i in item.items" style="margin-left: 10px;padding-bottom: 10px;">',
|
140
|
+
'<div class="itemContent lvl2ItemContent">{{i.text}}</div>',
|
141
|
+
'</div>',
|
142
|
+
'</div>',
|
143
|
+
'</div>',
|
144
|
+
'<div style="clear: both;"></div>'))($rootScope);
|
145
|
+
|
146
|
+
$rootScope.$apply(function() {
|
147
|
+
$rootScope.items = [
|
148
|
+
{
|
149
|
+
text: 'Item 1',
|
150
|
+
items: [
|
151
|
+
{ text: 'Item 1.1', items: [] },
|
152
|
+
{ text: 'Item 1.2', items: [] }
|
153
|
+
]
|
154
|
+
},
|
155
|
+
{
|
156
|
+
text: 'Item 2',
|
157
|
+
items: [
|
158
|
+
{ text: 'Item 2.1', items: [] },
|
159
|
+
{ text: 'Item 2.2', items: [] }
|
160
|
+
]
|
161
|
+
}
|
162
|
+
];
|
163
|
+
|
164
|
+
$rootScope.sortableOptions = {};
|
165
|
+
$rootScope.innerSortableOptions = {
|
166
|
+
connectWith: '.nested-sortable'
|
167
|
+
};
|
168
|
+
});
|
169
|
+
|
170
|
+
host.append(elementTree);
|
171
|
+
|
172
|
+
li1 = elementTree.find('.innerList:last');
|
173
|
+
li2 = elementTree.find('.innerList:first');
|
174
|
+
simulateElementDrag(li1, li2, { place: 'above', extradx: -10, extrady: -6 });
|
175
|
+
expect($rootScope.items.map(function(x){ return x.text; }))
|
176
|
+
.toEqual(['Item 2', 'Item 1']);
|
177
|
+
expect($rootScope.items.map(function(x){ return x.text; }))
|
178
|
+
.toEqual(listInnerContent(elementTree, '.lvl1ItemContent'));
|
179
|
+
|
180
|
+
$(elementTree).remove();
|
181
|
+
});
|
182
|
+
});
|
183
|
+
|
184
|
+
});
|
185
|
+
|
186
|
+
});
|
@@ -0,0 +1,895 @@
|
|
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, 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
|
+
beforeLiElement = sortableTestHelper.extraElements && sortableTestHelper.extraElements.beforeLiElement;
|
22
|
+
afterLiElement = sortableTestHelper.extraElements && sortableTestHelper.extraElements.afterLiElement;
|
23
|
+
}));
|
24
|
+
|
25
|
+
tests.description = 'Drag & Drop simulation';
|
26
|
+
function tests (useExtraElements) {
|
27
|
+
|
28
|
+
var host;
|
29
|
+
|
30
|
+
beforeEach(inject(function() {
|
31
|
+
host = $('<div id="test-host"></div>');
|
32
|
+
$('body').append(host);
|
33
|
+
|
34
|
+
if (!useExtraElements) {
|
35
|
+
beforeLiElement = afterLiElement = '';
|
36
|
+
}
|
37
|
+
}));
|
38
|
+
|
39
|
+
afterEach(function() {
|
40
|
+
host.remove();
|
41
|
+
host = null;
|
42
|
+
});
|
43
|
+
|
44
|
+
it('should update model when order changes', function() {
|
45
|
+
inject(function($compile, $rootScope) {
|
46
|
+
var element;
|
47
|
+
element = $compile(''.concat(
|
48
|
+
'<ul ui-sortable ng-model="items">',
|
49
|
+
beforeLiElement,
|
50
|
+
'<li ng-repeat="item in items" id="s-{{$index}}">{{ item }}</li>',
|
51
|
+
afterLiElement,
|
52
|
+
'</ul>'))($rootScope);
|
53
|
+
$rootScope.$apply(function() {
|
54
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
55
|
+
});
|
56
|
+
|
57
|
+
host.append(element);
|
58
|
+
|
59
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
60
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
61
|
+
li.simulate('drag', { dy: dy });
|
62
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
63
|
+
expect($rootScope.items).toEqual(listContent(element));
|
64
|
+
|
65
|
+
li = element.find('[ng-repeat]:eq(1)');
|
66
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
67
|
+
li.simulate('drag', { dy: dy });
|
68
|
+
expect($rootScope.items).toEqual(['Three', 'One', 'Two']);
|
69
|
+
expect($rootScope.items).toEqual(listContent(element));
|
70
|
+
|
71
|
+
$(element).remove();
|
72
|
+
});
|
73
|
+
});
|
74
|
+
|
75
|
+
it('should not allow sorting of "locked" nodes', function() {
|
76
|
+
inject(function($compile, $rootScope) {
|
77
|
+
var element;
|
78
|
+
element = $compile(''.concat(
|
79
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
80
|
+
beforeLiElement,
|
81
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" ng-class="{ sortable: item.sortable }">{{ item.text }}</li>',
|
82
|
+
afterLiElement,
|
83
|
+
'</ul>'))($rootScope);
|
84
|
+
$rootScope.$apply(function() {
|
85
|
+
$rootScope.opts = {
|
86
|
+
items:'> .sortable'
|
87
|
+
};
|
88
|
+
$rootScope.items = [
|
89
|
+
{ text: 'One', sortable: true },
|
90
|
+
{ text: 'Two', sortable: true },
|
91
|
+
{ text: 'Three', sortable: false },
|
92
|
+
{ text: 'Four', sortable: true }
|
93
|
+
];
|
94
|
+
});
|
95
|
+
|
96
|
+
host.append(element);
|
97
|
+
|
98
|
+
var li = element.find('[ng-repeat]:eq(2)');
|
99
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
100
|
+
li.simulate('drag', { dy: dy });
|
101
|
+
expect($rootScope.items.map(function(x){ return x.text; })).toEqual(['One', 'Two', 'Three', 'Four']);
|
102
|
+
expect($rootScope.items.map(function(x){ return x.text; })).toEqual(listContent(element));
|
103
|
+
|
104
|
+
li = element.find('[ng-repeat]:eq(1)');
|
105
|
+
dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
106
|
+
li.simulate('drag', { dy: dy });
|
107
|
+
expect($rootScope.items.map(function(x){ return x.text; })).toEqual(['One', 'Three', 'Four', 'Two']);
|
108
|
+
expect($rootScope.items.map(function(x){ return x.text; })).toEqual(listContent(element));
|
109
|
+
|
110
|
+
li = element.find('[ng-repeat]:eq(2)');
|
111
|
+
dy = -(2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
112
|
+
li.simulate('drag', { dy: dy });
|
113
|
+
expect($rootScope.items.map(function(x){ return x.text; })).toEqual(['Four', 'One', 'Three', 'Two']);
|
114
|
+
expect($rootScope.items.map(function(x){ return x.text; })).toEqual(listContent(element));
|
115
|
+
|
116
|
+
li = element.find('[ng-repeat]:eq(3)');
|
117
|
+
dy = -(2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
118
|
+
li.simulate('drag', { dy: dy });
|
119
|
+
expect($rootScope.items.map(function(x){ return x.text; })).toEqual(['Four', 'Two', 'One', 'Three']);
|
120
|
+
expect($rootScope.items.map(function(x){ return x.text; })).toEqual(listContent(element));
|
121
|
+
|
122
|
+
// also placing right above the locked node seems a bit harder !?!?
|
123
|
+
|
124
|
+
$(element).remove();
|
125
|
+
});
|
126
|
+
});
|
127
|
+
|
128
|
+
it('should work when "placeholder" option is used', function() {
|
129
|
+
inject(function($compile, $rootScope) {
|
130
|
+
var element;
|
131
|
+
element = $compile(''.concat(
|
132
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
133
|
+
beforeLiElement,
|
134
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
135
|
+
afterLiElement,
|
136
|
+
'</ul>'))($rootScope);
|
137
|
+
$rootScope.$apply(function() {
|
138
|
+
$rootScope.opts = {
|
139
|
+
placeholder: 'sortable-item-placeholder'
|
140
|
+
};
|
141
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
142
|
+
});
|
143
|
+
|
144
|
+
host.append(element);
|
145
|
+
|
146
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
147
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
148
|
+
li.simulate('drag', { dy: dy });
|
149
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
150
|
+
expect($rootScope.items).toEqual(listContent(element));
|
151
|
+
|
152
|
+
li = element.find('[ng-repeat]:eq(1)');
|
153
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
154
|
+
li.simulate('drag', { dy: dy });
|
155
|
+
expect($rootScope.items).toEqual(['Three', 'One', 'Two']);
|
156
|
+
expect($rootScope.items).toEqual(listContent(element));
|
157
|
+
|
158
|
+
$(element).remove();
|
159
|
+
});
|
160
|
+
});
|
161
|
+
|
162
|
+
it('should work when "placeholder" option equals the class of items', function() {
|
163
|
+
inject(function($compile, $rootScope) {
|
164
|
+
var element;
|
165
|
+
element = $compile(''.concat(
|
166
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
167
|
+
beforeLiElement,
|
168
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
169
|
+
afterLiElement,
|
170
|
+
'</ul>'))($rootScope);
|
171
|
+
$rootScope.$apply(function() {
|
172
|
+
$rootScope.opts = {
|
173
|
+
placeholder: 'sortable-item'
|
174
|
+
};
|
175
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
176
|
+
});
|
177
|
+
|
178
|
+
host.append(element);
|
179
|
+
|
180
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
181
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
182
|
+
li.simulate('drag', { dy: dy });
|
183
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
184
|
+
expect($rootScope.items).toEqual(listContent(element));
|
185
|
+
|
186
|
+
li = element.find('[ng-repeat]:eq(1)');
|
187
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
188
|
+
li.simulate('drag', { dy: dy });
|
189
|
+
expect($rootScope.items).toEqual(['Three', 'One', 'Two']);
|
190
|
+
expect($rootScope.items).toEqual(listContent(element));
|
191
|
+
|
192
|
+
$(element).remove();
|
193
|
+
});
|
194
|
+
});
|
195
|
+
|
196
|
+
it('should work when "placeholder" option equals the class of items [data-ng-repeat]', function() {
|
197
|
+
inject(function($compile, $rootScope) {
|
198
|
+
var element;
|
199
|
+
element = $compile(''.concat(
|
200
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
201
|
+
beforeLiElement,
|
202
|
+
'<li data-ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
203
|
+
afterLiElement,
|
204
|
+
'</ul>'))($rootScope);
|
205
|
+
$rootScope.$apply(function() {
|
206
|
+
$rootScope.opts = {
|
207
|
+
placeholder: 'sortable-item'
|
208
|
+
};
|
209
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
210
|
+
});
|
211
|
+
|
212
|
+
host.append(element);
|
213
|
+
|
214
|
+
var li = element.find('[data-ng-repeat]:eq(1)');
|
215
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
216
|
+
li.simulate('drag', { dy: dy });
|
217
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
218
|
+
expect($rootScope.items).toEqual(listContent(element));
|
219
|
+
|
220
|
+
li = element.find('[data-ng-repeat]:eq(1)');
|
221
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
222
|
+
li.simulate('drag', { dy: dy });
|
223
|
+
expect($rootScope.items).toEqual(['Three', 'One', 'Two']);
|
224
|
+
expect($rootScope.items).toEqual(listContent(element));
|
225
|
+
|
226
|
+
$(element).remove();
|
227
|
+
});
|
228
|
+
});
|
229
|
+
|
230
|
+
it('should continue to work after a drag is reverted', function() {
|
231
|
+
inject(function($compile, $rootScope) {
|
232
|
+
var element;
|
233
|
+
element = $compile(''.concat(
|
234
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
235
|
+
beforeLiElement,
|
236
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
237
|
+
afterLiElement,
|
238
|
+
'</ul>'))($rootScope);
|
239
|
+
$rootScope.$apply(function() {
|
240
|
+
$rootScope.opts = {
|
241
|
+
placeholder: 'sortable-item'
|
242
|
+
};
|
243
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
244
|
+
});
|
245
|
+
|
246
|
+
host.append(element);
|
247
|
+
|
248
|
+
var li = element.find('[ng-repeat]:eq(0)');
|
249
|
+
var dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
250
|
+
li.simulate('dragAndRevert', { dy: dy });
|
251
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
252
|
+
expect($rootScope.items).toEqual(listContent(element));
|
253
|
+
|
254
|
+
li = element.find('[ng-repeat]:eq(0)');
|
255
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
256
|
+
li.simulate('drag', { dy: dy });
|
257
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
258
|
+
expect($rootScope.items).toEqual(listContent(element));
|
259
|
+
|
260
|
+
li = element.find('[ng-repeat]:eq(1)');
|
261
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
262
|
+
li.simulate('drag', { dy: dy });
|
263
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
264
|
+
expect($rootScope.items).toEqual(listContent(element));
|
265
|
+
|
266
|
+
li = element.find('[ng-repeat]:eq(1)');
|
267
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
268
|
+
li.simulate('drag', { dy: dy });
|
269
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
270
|
+
expect($rootScope.items).toEqual(listContent(element));
|
271
|
+
|
272
|
+
$(element).remove();
|
273
|
+
});
|
274
|
+
});
|
275
|
+
|
276
|
+
it('should work when "handle" option is used', function() {
|
277
|
+
inject(function($compile, $rootScope) {
|
278
|
+
var element;
|
279
|
+
element = $compile(''.concat(
|
280
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
281
|
+
beforeLiElement,
|
282
|
+
'<li ng-repeat="item in items" id="s-{{$index}}"><span class="handle">H</span> <span class="itemContent">{{ item }}</span></li>',
|
283
|
+
afterLiElement,
|
284
|
+
'</ul>'))($rootScope);
|
285
|
+
$rootScope.$apply(function() {
|
286
|
+
$rootScope.opts = {
|
287
|
+
handle: '.handle'
|
288
|
+
};
|
289
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
290
|
+
});
|
291
|
+
|
292
|
+
host.append(element);
|
293
|
+
|
294
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
295
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
296
|
+
li.find('.handle').simulate('drag', { dy: dy });
|
297
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
298
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
299
|
+
|
300
|
+
li = element.find('[ng-repeat]:eq(1)');
|
301
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
302
|
+
li.find('.handle').simulate('drag', { dy: dy });
|
303
|
+
expect($rootScope.items).toEqual(['Three', 'One', 'Two']);
|
304
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
305
|
+
|
306
|
+
$(element).remove();
|
307
|
+
});
|
308
|
+
});
|
309
|
+
|
310
|
+
it('should properly remove elements after a sorting', function() {
|
311
|
+
inject(function($compile, $rootScope) {
|
312
|
+
var element;
|
313
|
+
element = $compile(''.concat(
|
314
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
315
|
+
beforeLiElement,
|
316
|
+
'<li ng-repeat="item in items" id="s-{{$index}}"><span class="handle">H</span> <span class="itemContent">{{ item }}</span> <button type="button" class="removeButton" ng-click="remove(item, $index)">X</button></li>',
|
317
|
+
afterLiElement,
|
318
|
+
'</ul>'))($rootScope);
|
319
|
+
$rootScope.$apply(function() {
|
320
|
+
$rootScope.opts = {
|
321
|
+
handle: '.handle'
|
322
|
+
};
|
323
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
324
|
+
|
325
|
+
$rootScope.remove = function (item, itemIndex) {
|
326
|
+
$rootScope.items.splice(itemIndex, 1);
|
327
|
+
};
|
328
|
+
});
|
329
|
+
|
330
|
+
host.append(element);
|
331
|
+
|
332
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
333
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
334
|
+
li.find('.handle').simulate('drag', { dy: dy });
|
335
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
336
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
337
|
+
|
338
|
+
li = element.find('[ng-repeat]:eq(1)');
|
339
|
+
li.find('.removeButton').click();
|
340
|
+
expect($rootScope.items).toEqual(['One', 'Two']);
|
341
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
342
|
+
|
343
|
+
li = element.find('[ng-repeat]:eq(0)');
|
344
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
345
|
+
li.find('.handle').simulate('drag', { dy: dy });
|
346
|
+
expect($rootScope.items).toEqual(['Two', 'One']);
|
347
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
348
|
+
|
349
|
+
li = element.find('[ng-repeat]:eq(0)');
|
350
|
+
li.find('.removeButton').click();
|
351
|
+
expect($rootScope.items).toEqual(['One']);
|
352
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
353
|
+
|
354
|
+
$(element).remove();
|
355
|
+
});
|
356
|
+
});
|
357
|
+
|
358
|
+
it('should properly remove elements after a drag is reverted', function() {
|
359
|
+
inject(function($compile, $rootScope) {
|
360
|
+
var element;
|
361
|
+
element = $compile(''.concat(
|
362
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
363
|
+
beforeLiElement,
|
364
|
+
'<li ng-repeat="item in items" id="s-{{$index}}"><span class="handle">H</span> <span class="itemContent">{{ item }}</span> <button type="button" class="removeButton" ng-click="remove(item, $index)">X</button></li>',
|
365
|
+
afterLiElement,
|
366
|
+
'</ul>'))($rootScope);
|
367
|
+
$rootScope.$apply(function() {
|
368
|
+
$rootScope.opts = {
|
369
|
+
handle: '.handle'
|
370
|
+
};
|
371
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
372
|
+
|
373
|
+
$rootScope.remove = function (item, itemIndex) {
|
374
|
+
$rootScope.items.splice(itemIndex, 1);
|
375
|
+
};
|
376
|
+
});
|
377
|
+
|
378
|
+
host.append(element);
|
379
|
+
|
380
|
+
var li = element.find('[ng-repeat]:eq(0)');
|
381
|
+
var dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
382
|
+
li.find('.handle').simulate('dragAndRevert', { dy: dy });
|
383
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
384
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
385
|
+
|
386
|
+
li = element.find('[ng-repeat]:eq(0)');
|
387
|
+
li.find('.removeButton').click();
|
388
|
+
expect($rootScope.items).toEqual(['Two', 'Three']);
|
389
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
390
|
+
|
391
|
+
li = element.find('[ng-repeat]:eq(0)');
|
392
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
393
|
+
li.find('.handle').simulate('drag', { dy: dy });
|
394
|
+
expect($rootScope.items).toEqual(['Three', 'Two']);
|
395
|
+
expect($rootScope.items).toEqual(listInnerContent(element));
|
396
|
+
|
397
|
+
$(element).remove();
|
398
|
+
});
|
399
|
+
});
|
400
|
+
|
401
|
+
it('should work when "helper: clone" option is used', function() {
|
402
|
+
inject(function($compile, $rootScope) {
|
403
|
+
var element;
|
404
|
+
element = $compile(''.concat(
|
405
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
406
|
+
beforeLiElement,
|
407
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
408
|
+
afterLiElement,
|
409
|
+
'</ul>'))($rootScope);
|
410
|
+
$rootScope.$apply(function() {
|
411
|
+
$rootScope.opts = {
|
412
|
+
helper: 'clone'
|
413
|
+
};
|
414
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
415
|
+
});
|
416
|
+
|
417
|
+
host.append(element);
|
418
|
+
|
419
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
420
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
421
|
+
li.simulate('drag', { dy: dy });
|
422
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
423
|
+
expect($rootScope.items).toEqual(listContent(element));
|
424
|
+
|
425
|
+
li = element.find('[ng-repeat]:eq(1)');
|
426
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
427
|
+
li.simulate('drag', { dy: dy });
|
428
|
+
expect($rootScope.items).toEqual(['Three', 'One', 'Two']);
|
429
|
+
expect($rootScope.items).toEqual(listContent(element));
|
430
|
+
|
431
|
+
$(element).remove();
|
432
|
+
});
|
433
|
+
});
|
434
|
+
|
435
|
+
it('should work when "helper: clone" option is used and a drag is reverted', function() {
|
436
|
+
inject(function($compile, $rootScope) {
|
437
|
+
var element;
|
438
|
+
element = $compile(''.concat(
|
439
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
440
|
+
beforeLiElement,
|
441
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
442
|
+
afterLiElement,
|
443
|
+
'</ul>'))($rootScope);
|
444
|
+
$rootScope.$apply(function() {
|
445
|
+
$rootScope.opts = {
|
446
|
+
helper: 'clone'
|
447
|
+
};
|
448
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
449
|
+
});
|
450
|
+
|
451
|
+
host.append(element);
|
452
|
+
|
453
|
+
var li = element.find('[ng-repeat]:eq(0)');
|
454
|
+
var dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
455
|
+
li.simulate('dragAndRevert', { dy: dy });
|
456
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
457
|
+
expect($rootScope.items).toEqual(listContent(element));
|
458
|
+
|
459
|
+
li = element.find('[ng-repeat]:eq(0)');
|
460
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
461
|
+
li.simulate('drag', { dy: dy });
|
462
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
463
|
+
expect($rootScope.items).toEqual(listContent(element));
|
464
|
+
|
465
|
+
li = element.find('[ng-repeat]:eq(1)');
|
466
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
467
|
+
li.simulate('drag', { dy: dy });
|
468
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
469
|
+
expect($rootScope.items).toEqual(listContent(element));
|
470
|
+
|
471
|
+
li = element.find('[ng-repeat]:eq(1)');
|
472
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
473
|
+
li.simulate('drag', { dy: dy });
|
474
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
475
|
+
expect($rootScope.items).toEqual(listContent(element));
|
476
|
+
|
477
|
+
$(element).remove();
|
478
|
+
});
|
479
|
+
});
|
480
|
+
|
481
|
+
it('should work when "helper: clone" and "appendTo [selector]" options are used together', function() {
|
482
|
+
inject(function($compile, $rootScope) {
|
483
|
+
var element;
|
484
|
+
element = $compile(''.concat(
|
485
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
486
|
+
beforeLiElement,
|
487
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
488
|
+
afterLiElement,
|
489
|
+
'</ul>'))($rootScope);
|
490
|
+
$rootScope.$apply(function() {
|
491
|
+
$rootScope.opts = {
|
492
|
+
helper: 'clone',
|
493
|
+
appendTo: 'body'
|
494
|
+
};
|
495
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
496
|
+
});
|
497
|
+
|
498
|
+
host.append(element);
|
499
|
+
|
500
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
501
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
502
|
+
li.simulate('drag', { dy: dy });
|
503
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
504
|
+
expect($rootScope.items).toEqual(listContent(element));
|
505
|
+
|
506
|
+
li = element.find('[ng-repeat]:eq(2)');
|
507
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
508
|
+
li.simulate('drag', { dy: dy });
|
509
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
510
|
+
expect($rootScope.items).toEqual(listContent(element));
|
511
|
+
|
512
|
+
$(element).remove();
|
513
|
+
});
|
514
|
+
});
|
515
|
+
|
516
|
+
it('should work when "helper: clone" and "appendTo [element]" options are used together', function() {
|
517
|
+
inject(function($compile, $rootScope) {
|
518
|
+
var element;
|
519
|
+
element = $compile(''.concat(
|
520
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
521
|
+
beforeLiElement,
|
522
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
523
|
+
afterLiElement,
|
524
|
+
'</ul>'))($rootScope);
|
525
|
+
$rootScope.$apply(function() {
|
526
|
+
$rootScope.opts = {
|
527
|
+
helper: 'clone',
|
528
|
+
appendTo: document.body
|
529
|
+
};
|
530
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
531
|
+
});
|
532
|
+
|
533
|
+
host.append(element);
|
534
|
+
|
535
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
536
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
537
|
+
li.simulate('drag', { dy: dy });
|
538
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
539
|
+
expect($rootScope.items).toEqual(listContent(element));
|
540
|
+
|
541
|
+
li = element.find('[ng-repeat]:eq(2)');
|
542
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
543
|
+
li.simulate('drag', { dy: dy });
|
544
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
545
|
+
expect($rootScope.items).toEqual(listContent(element));
|
546
|
+
|
547
|
+
$(element).remove();
|
548
|
+
});
|
549
|
+
});
|
550
|
+
|
551
|
+
it('should work when "helper: clone" and "appendTo [jQuery object]" options are used together', function() {
|
552
|
+
inject(function($compile, $rootScope) {
|
553
|
+
var element;
|
554
|
+
element = $compile(''.concat(
|
555
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
556
|
+
beforeLiElement,
|
557
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
558
|
+
afterLiElement,
|
559
|
+
'</ul>'))($rootScope);
|
560
|
+
$rootScope.$apply(function() {
|
561
|
+
$rootScope.opts = {
|
562
|
+
helper: 'clone',
|
563
|
+
appendTo: angular.element(document.body)
|
564
|
+
};
|
565
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
566
|
+
});
|
567
|
+
|
568
|
+
host.append(element);
|
569
|
+
|
570
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
571
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
572
|
+
li.simulate('drag', { dy: dy });
|
573
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
574
|
+
expect($rootScope.items).toEqual(listContent(element));
|
575
|
+
|
576
|
+
li = element.find('[ng-repeat]:eq(2)');
|
577
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
578
|
+
li.simulate('drag', { dy: dy });
|
579
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
580
|
+
expect($rootScope.items).toEqual(listContent(element));
|
581
|
+
|
582
|
+
$(element).remove();
|
583
|
+
});
|
584
|
+
});
|
585
|
+
|
586
|
+
it('should work when "helper: clone" and "placeholder" options are used together.', function() {
|
587
|
+
inject(function($compile, $rootScope) {
|
588
|
+
var element;
|
589
|
+
element = $compile(''.concat(
|
590
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
591
|
+
beforeLiElement,
|
592
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
593
|
+
afterLiElement,
|
594
|
+
'</ul>'))($rootScope);
|
595
|
+
$rootScope.$apply(function() {
|
596
|
+
$rootScope.opts = {
|
597
|
+
helper: 'clone',
|
598
|
+
placeholder: 'sortable-item'
|
599
|
+
};
|
600
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
601
|
+
});
|
602
|
+
|
603
|
+
host.append(element);
|
604
|
+
|
605
|
+
var li = element.find('[ng-repeat]:eq(0)');
|
606
|
+
var dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
607
|
+
li.simulate('dragAndRevert', { dy: dy });
|
608
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
609
|
+
expect($rootScope.items).toEqual(listContent(element));
|
610
|
+
|
611
|
+
li = element.find('[ng-repeat]:eq(0)');
|
612
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
613
|
+
li.simulate('drag', { dy: dy });
|
614
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
615
|
+
expect($rootScope.items).toEqual(listContent(element));
|
616
|
+
|
617
|
+
li = element.find('[ng-repeat]:eq(1)');
|
618
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
619
|
+
li.simulate('drag', { dy: dy });
|
620
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
621
|
+
expect($rootScope.items).toEqual(listContent(element));
|
622
|
+
|
623
|
+
li = element.find('[ng-repeat]:eq(1)');
|
624
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
625
|
+
li.simulate('dragAndRevert', { dy: dy });
|
626
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
627
|
+
expect($rootScope.items).toEqual(listContent(element));
|
628
|
+
|
629
|
+
li = element.find('[ng-repeat]:eq(1)');
|
630
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
631
|
+
li.simulate('drag', { dy: dy });
|
632
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
633
|
+
expect($rootScope.items).toEqual(listContent(element));
|
634
|
+
|
635
|
+
$(element).remove();
|
636
|
+
});
|
637
|
+
});
|
638
|
+
|
639
|
+
it('should work when "helper: function" option is used', function() {
|
640
|
+
inject(function($compile, $rootScope) {
|
641
|
+
var element;
|
642
|
+
element = $compile(''.concat(
|
643
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
644
|
+
beforeLiElement,
|
645
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
646
|
+
afterLiElement,
|
647
|
+
'</ul>'))($rootScope);
|
648
|
+
$rootScope.$apply(function() {
|
649
|
+
$rootScope.opts = {
|
650
|
+
helper: function (e, item) {
|
651
|
+
return item.clone().text('helper');
|
652
|
+
}
|
653
|
+
};
|
654
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
655
|
+
});
|
656
|
+
|
657
|
+
host.append(element);
|
658
|
+
|
659
|
+
var li = element.find('[ng-repeat]:eq(1)');
|
660
|
+
var dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
661
|
+
li.simulate('drag', { dy: dy });
|
662
|
+
expect($rootScope.items).toEqual(['One', 'Three', 'Two']);
|
663
|
+
expect($rootScope.items).toEqual(listContent(element));
|
664
|
+
|
665
|
+
li = element.find('[ng-repeat]:eq(1)');
|
666
|
+
dy = -(1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
667
|
+
li.simulate('drag', { dy: dy });
|
668
|
+
expect($rootScope.items).toEqual(['Three', 'One', 'Two']);
|
669
|
+
expect($rootScope.items).toEqual(listContent(element));
|
670
|
+
|
671
|
+
$(element).remove();
|
672
|
+
});
|
673
|
+
});
|
674
|
+
|
675
|
+
it('should work when "helper: function" option is used and a drag is reverted', function() {
|
676
|
+
inject(function($compile, $rootScope) {
|
677
|
+
var element;
|
678
|
+
element = $compile(''.concat(
|
679
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
680
|
+
beforeLiElement,
|
681
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
682
|
+
afterLiElement,
|
683
|
+
'</ul>'))($rootScope);
|
684
|
+
$rootScope.$apply(function() {
|
685
|
+
$rootScope.opts = {
|
686
|
+
helper: function (e, item) {
|
687
|
+
return item.clone().text('helper');
|
688
|
+
}
|
689
|
+
};
|
690
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
691
|
+
});
|
692
|
+
|
693
|
+
host.append(element);
|
694
|
+
|
695
|
+
var li = element.find('[ng-repeat]:eq(0)');
|
696
|
+
var dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
697
|
+
li.simulate('dragAndRevert', { dy: dy });
|
698
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
699
|
+
expect($rootScope.items).toEqual(listContent(element));
|
700
|
+
|
701
|
+
li = element.find('[ng-repeat]:eq(0)');
|
702
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
703
|
+
li.simulate('drag', { dy: dy });
|
704
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
705
|
+
expect($rootScope.items).toEqual(listContent(element));
|
706
|
+
|
707
|
+
li = element.find('[ng-repeat]:eq(1)');
|
708
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
709
|
+
li.simulate('drag', { dy: dy });
|
710
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
711
|
+
expect($rootScope.items).toEqual(listContent(element));
|
712
|
+
|
713
|
+
li = element.find('[ng-repeat]:eq(1)');
|
714
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
715
|
+
li.simulate('drag', { dy: dy });
|
716
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
717
|
+
expect($rootScope.items).toEqual(listContent(element));
|
718
|
+
|
719
|
+
$(element).remove();
|
720
|
+
});
|
721
|
+
});
|
722
|
+
|
723
|
+
it('should work when "helper: function" and "placeholder" options are used together.', function() {
|
724
|
+
inject(function($compile, $rootScope) {
|
725
|
+
var element;
|
726
|
+
element = $compile(''.concat(
|
727
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
728
|
+
beforeLiElement,
|
729
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
730
|
+
afterLiElement,
|
731
|
+
'</ul>'))($rootScope);
|
732
|
+
$rootScope.$apply(function() {
|
733
|
+
$rootScope.opts = {
|
734
|
+
helper: function (e, item) {
|
735
|
+
return item.clone().text('helper');
|
736
|
+
},
|
737
|
+
placeholder: 'sortable-item'
|
738
|
+
};
|
739
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
740
|
+
});
|
741
|
+
|
742
|
+
host.append(element);
|
743
|
+
|
744
|
+
var li = element.find('[ng-repeat]:eq(0)');
|
745
|
+
var dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
746
|
+
li.simulate('dragAndRevert', { dy: dy });
|
747
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
748
|
+
expect($rootScope.items).toEqual(listContent(element));
|
749
|
+
|
750
|
+
li = element.find('[ng-repeat]:eq(0)');
|
751
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
752
|
+
li.simulate('drag', { dy: dy });
|
753
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
754
|
+
expect($rootScope.items).toEqual(listContent(element));
|
755
|
+
|
756
|
+
li = element.find('[ng-repeat]:eq(1)');
|
757
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
758
|
+
li.simulate('drag', { dy: dy });
|
759
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
760
|
+
expect($rootScope.items).toEqual(listContent(element));
|
761
|
+
|
762
|
+
li = element.find('[ng-repeat]:eq(1)');
|
763
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
764
|
+
li.simulate('dragAndRevert', { dy: dy });
|
765
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
766
|
+
expect($rootScope.items).toEqual(listContent(element));
|
767
|
+
|
768
|
+
li = element.find('[ng-repeat]:eq(1)');
|
769
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
770
|
+
li.simulate('drag', { dy: dy });
|
771
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
772
|
+
expect($rootScope.items).toEqual(listContent(element));
|
773
|
+
|
774
|
+
$(element).remove();
|
775
|
+
});
|
776
|
+
});
|
777
|
+
|
778
|
+
it('should work when "helper: function" that returns a list element is used', function() {
|
779
|
+
inject(function($compile, $rootScope) {
|
780
|
+
var element;
|
781
|
+
element = $compile(''.concat(
|
782
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
783
|
+
beforeLiElement,
|
784
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
785
|
+
afterLiElement,
|
786
|
+
'</ul>'))($rootScope);
|
787
|
+
$rootScope.$apply(function() {
|
788
|
+
$rootScope.opts = {
|
789
|
+
helper: function (e, item) {
|
790
|
+
return item;
|
791
|
+
}
|
792
|
+
};
|
793
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
794
|
+
});
|
795
|
+
|
796
|
+
host.append(element);
|
797
|
+
|
798
|
+
var li = element.find('[ng-repeat]:eq(0)');
|
799
|
+
var dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
800
|
+
li.simulate('dragAndRevert', { dy: dy });
|
801
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
802
|
+
expect($rootScope.items).toEqual(listContent(element));
|
803
|
+
|
804
|
+
li = element.find('[ng-repeat]:eq(0)');
|
805
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
806
|
+
li.simulate('drag', { dy: dy });
|
807
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
808
|
+
expect($rootScope.items).toEqual(listContent(element));
|
809
|
+
|
810
|
+
li = element.find('[ng-repeat]:eq(1)');
|
811
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
812
|
+
li.simulate('drag', { dy: dy });
|
813
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
814
|
+
expect($rootScope.items).toEqual(listContent(element));
|
815
|
+
|
816
|
+
li = element.find('[ng-repeat]:eq(1)');
|
817
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
818
|
+
li.simulate('drag', { dy: dy });
|
819
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
820
|
+
expect($rootScope.items).toEqual(listContent(element));
|
821
|
+
|
822
|
+
$(element).remove();
|
823
|
+
});
|
824
|
+
});
|
825
|
+
|
826
|
+
it('should work when "helper: function" that returns a list element and "placeholder" options are used together.', function() {
|
827
|
+
inject(function($compile, $rootScope) {
|
828
|
+
var element;
|
829
|
+
element = $compile(''.concat(
|
830
|
+
'<ul ui-sortable="opts" ng-model="items">',
|
831
|
+
beforeLiElement,
|
832
|
+
'<li ng-repeat="item in items" id="s-{{$index}}" class="sortable-item">{{ item }}</li>',
|
833
|
+
afterLiElement,
|
834
|
+
'</ul>'))($rootScope);
|
835
|
+
$rootScope.$apply(function() {
|
836
|
+
$rootScope.opts = {
|
837
|
+
helper: function (e, item) {
|
838
|
+
return item;
|
839
|
+
},
|
840
|
+
placeholder: 'sortable-item'
|
841
|
+
};
|
842
|
+
$rootScope.items = ['One', 'Two', 'Three'];
|
843
|
+
});
|
844
|
+
|
845
|
+
host.append(element);
|
846
|
+
|
847
|
+
var li = element.find('[ng-repeat]:eq(0)');
|
848
|
+
var dy = (2 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
849
|
+
li.simulate('dragAndRevert', { dy: dy });
|
850
|
+
expect($rootScope.items).toEqual(['One', 'Two', 'Three']);
|
851
|
+
expect($rootScope.items).toEqual(listContent(element));
|
852
|
+
|
853
|
+
li = element.find('[ng-repeat]:eq(0)');
|
854
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
855
|
+
li.simulate('drag', { dy: dy });
|
856
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
857
|
+
expect($rootScope.items).toEqual(listContent(element));
|
858
|
+
|
859
|
+
li = element.find('[ng-repeat]:eq(1)');
|
860
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
861
|
+
li.simulate('drag', { dy: dy });
|
862
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
863
|
+
expect($rootScope.items).toEqual(listContent(element));
|
864
|
+
|
865
|
+
li = element.find('[ng-repeat]:eq(1)');
|
866
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
867
|
+
li.simulate('dragAndRevert', { dy: dy });
|
868
|
+
expect($rootScope.items).toEqual(['Two', 'Three', 'One']);
|
869
|
+
expect($rootScope.items).toEqual(listContent(element));
|
870
|
+
|
871
|
+
li = element.find('[ng-repeat]:eq(1)');
|
872
|
+
dy = (1 + EXTRA_DY_PERCENTAGE) * li.outerHeight();
|
873
|
+
li.simulate('drag', { dy: dy });
|
874
|
+
expect($rootScope.items).toEqual(['Two', 'One', 'Three']);
|
875
|
+
expect($rootScope.items).toEqual(listContent(element));
|
876
|
+
|
877
|
+
$(element).remove();
|
878
|
+
});
|
879
|
+
});
|
880
|
+
|
881
|
+
}
|
882
|
+
|
883
|
+
[0, 1].forEach(function(useExtraElements){
|
884
|
+
var testDescription = tests.description;
|
885
|
+
|
886
|
+
if (useExtraElements) {
|
887
|
+
testDescription += ' with extra elements';
|
888
|
+
}
|
889
|
+
|
890
|
+
describe(testDescription, function(){
|
891
|
+
tests(useExtraElements);
|
892
|
+
});
|
893
|
+
});
|
894
|
+
|
895
|
+
});
|