b2g/components/test/unit/test_bug793310.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:1cfdbc8c6768
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function run_test() {
5 Components.utils.import("resource:///modules/TelURIParser.jsm")
6
7 // global-phone-number
8 do_check_eq(TelURIParser.parseURI('tel', 'tel:+1234'), '+1234');
9
10 // global-phone-number => white space separator
11 do_check_eq(TelURIParser.parseURI('tel', 'tel:+123 456 789'), '+123 456 789');
12
13 // global-phone-number => ignored chars
14 do_check_eq(TelURIParser.parseURI('tel', 'tel:+1234_123'), '+1234');
15
16 // global-phone-number => visualSeparator + digits
17 do_check_eq(TelURIParser.parseURI('tel', 'tel:+-.()1234567890'), '+-.()1234567890');
18
19 // local-phone-number
20 do_check_eq(TelURIParser.parseURI('tel', 'tel:1234'), '1234');
21
22 // local-phone-number => visualSeparator + digits + dtmfDigits + pauseCharacter
23 do_check_eq(TelURIParser.parseURI('tel', 'tel:-.()1234567890ABCDpw'), '-.()1234567890ABCDpw');
24
25 // local-phone-number => visualSeparator + digits + dtmfDigits + pauseCharacter + ignored chars
26 do_check_eq(TelURIParser.parseURI('tel', 'tel:-.()1234567890ABCDpw_'), '-.()1234567890ABCDpw');
27
28 // local-phone-number => isdn-subaddress
29 do_check_eq(TelURIParser.parseURI('tel', 'tel:123;isub=123'), '123');
30
31 // local-phone-number => post-dial
32 do_check_eq(TelURIParser.parseURI('tel', 'tel:123;postd=123'), '123');
33
34 // local-phone-number => prefix
35 do_check_eq(TelURIParser.parseURI('tel', 'tel:123;phone-context=+0321'), '+0321123');
36
37 // local-phone-number => isdn-subaddress + post-dial + prefix
38 do_check_eq(TelURIParser.parseURI('tel', 'tel:123;isub=123;postd=123;phone-context=+0321'), '+0321123');
39 }

mercurial