diff --git a/js/views/conversation_search_view.js b/js/views/conversation_search_view.js index 7a04f5f1..a20e33c7 100644 --- a/js/views/conversation_search_view.js +++ b/js/views/conversation_search_view.js @@ -123,7 +123,7 @@ }, maybeNumber: function(number) { - return number.match(/^\+?[0-9]*$/); + return number.replace(/[\s-.\(\)]*/g,'').match(/^\+?[0-9]*$/); } }); diff --git a/test/index.html b/test/index.html index 2dc499d8..372690b3 100644 --- a/test/index.html +++ b/test/index.html @@ -125,11 +125,13 @@ + + diff --git a/test/views/conversation_search_view_test.js b/test/views/conversation_search_view_test.js new file mode 100644 index 00000000..4650df08 --- /dev/null +++ b/test/views/conversation_search_view_test.js @@ -0,0 +1,24 @@ +describe('ConversationSearchView', function() { + it('should match partial numbers', function() { + var $el = $('