diff --git a/src/typeahead/test/typeahead.spec.js b/src/typeahead/test/typeahead.spec.js index 6efd0f465c..efd02f552d 100644 --- a/src/typeahead/test/typeahead.spec.js +++ b/src/typeahead/test/typeahead.spec.js @@ -150,6 +150,16 @@ describe('typeahead tests', function () { expect(inputEl.attr('aria-activedescendant')).toBeUndefined(); }); + it('should allow expressions over multiple lines', function () { + var element = prepareInputEl('
'); + changeInputValueTo(element, 'ba'); + expect(element).toBeOpenWithActive(2, 0); + + changeInputValueTo(element, ''); + expect(element).toBeClosed(); + }); + it('should not open typeahead if input value smaller than a defined threshold', function () { var element = prepareInputEl('
'); changeInputValueTo(element, 'b'); diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index 832d88e71f..f8babc7c56 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -7,7 +7,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap .factory('typeaheadParser', ['$parse', function ($parse) { // 00000111000000000000022200000000000000003333333333333330000000000044000 - var TYPEAHEAD_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+(.*)$/; + var TYPEAHEAD_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/; return { parse:function (input) {