@@ -76,7 +76,45 @@ describe( "Autolinker.matcher.Email", function() {
7676 MatchChecker . expectEmailMatch ( matches [ 0 ] , 'o\'donnel@asdf.com' , 0 ) ;
7777 } ) ;
7878
79+ it ( 'should *not* match email with incorrect domain beginning with "-"' , function ( ) {
80+ var matches = matcher . parseMatches ( 'asdf@-asdf.com' ) ;
81+
82+ expect ( matches . length ) . toBe ( 0 ) ;
83+ } ) ;
84+
85+ it ( 'should *not* match email with incorrect domain ending with "-"' , function ( ) {
86+ var matches = matcher . parseMatches ( 'asdf@asdf-.com' ) ;
87+
88+ expect ( matches . length ) . toBe ( 0 ) ;
89+ } ) ;
90+
91+ it ( 'should *not* match email with incorrect domain beginning with "."' , function ( ) {
92+ var matches = matcher . parseMatches ( 'asdf@.asdf.com' ) ;
93+
94+ expect ( matches . length ) . toBe ( 0 ) ;
95+ } ) ;
96+
97+ it ( 'should *not* match email with incorrect local part beginning with "."' , function ( ) {
98+ var matches = matcher . parseMatches ( '.asdf@asdf.com' ) ;
99+
100+ expect ( matches . length ) . toBe ( 1 ) ;
101+ MatchChecker . expectEmailMatch ( matches [ 0 ] , 'asdf@asdf.com' , 1 ) ;
102+ } ) ;
103+
104+ it ( 'should *not* match email with incorrect local part ending with "."' , function ( ) {
105+ var matches = matcher . parseMatches ( 'asdf.@asdf.com' ) ;
106+
107+ expect ( matches . length ) . toBe ( 0 ) ;
108+ } ) ;
109+
110+ it ( 'should match email skipping incorrect local part tailing with ".."' , function ( ) {
111+ var matches = matcher . parseMatches ( 'asdf..asdf@asdf.com' ) ;
112+
113+ expect ( matches . length ) . toBe ( 1 ) ;
114+ MatchChecker . expectEmailMatch ( matches [ 0 ] , 'asdf@asdf.com' , 6 ) ;
115+ } ) ;
116+
79117 } ) ;
80118
81119
82- } ) ;
120+ } ) ;
0 commit comments