Use op-auto-complete in comment field and add test

pull/4450/head
Oliver Günther 9 years ago
parent 95541c1715
commit 8b9212bf73
  1. 1
      frontend/app/components/inplace-edit/field-directives/edit-wiki-textarea/edit-wiki-textarea.directive.html
  2. 10
      frontend/app/components/work-packages/work-package-comment/work-package-comment.directive.js
  3. 9
      spec/features/work_packages/details/activity_comments_spec.rb

@ -6,6 +6,7 @@
</label> </label>
<textarea <textarea
wiki-toolbar wiki-toolbar
op-auto-complete
style="min-height: 114px" style="min-height: 114px"
msd-elastic="\n" msd-elastic="\n"
class="focus-input inplace-edit--textarea -animated" class="focus-input inplace-edit--textarea -animated"

@ -31,7 +31,7 @@ angular
.directive('workPackageComment', workPackageComment); .directive('workPackageComment', workPackageComment);
function workPackageComment($timeout, $location, EditableFieldsState, FocusHelper, function workPackageComment($timeout, $location, EditableFieldsState, FocusHelper,
inplaceEditMultiStorage, ConfigurationService, AutoCompleteHelper, inplaceEditAll) { inplaceEditMultiStorage, ConfigurationService, inplaceEditAll) {
function commentFieldDirectiveController($scope, $element) { function commentFieldDirectiveController($scope, $element) {
var field = { var field = {
@ -163,12 +163,6 @@ function workPackageComment($timeout, $location, EditableFieldsState, FocusHelpe
controllerAs: 'fieldController', controllerAs: 'fieldController',
bindToController: true, bindToController: true,
controller: commentFieldDirectiveController, controller: commentFieldDirectiveController
link: function(scope, element) {
$timeout(function() {
AutoCompleteHelper.enableTextareaAutoCompletion(element.find('textarea'));
});
}
}; };
} }

@ -119,6 +119,15 @@ describe 'activity comments', js: true, selenium: true do
end end
end end
describe 'autocomplete' do
let!(:wp2) { FactoryGirl.create(:work_package, project: project, subject: 'AutoFoo') }
it 'autocompletes the other work package' do
comment_field.input_element.send_keys("##{wp2.id}")
expect(page).to have_selector('.atwho-view-ul li', text: wp2.to_s.strip)
end
end
describe 'quoting' do describe 'quoting' do
it 'can quote a previous comment' do it 'can quote a previous comment' do
expect(page).to have_selector('.user-comment .message', expect(page).to have_selector('.user-comment .message',

Loading…
Cancel
Save