Mercurial > hg > mpiwg_geobrowser
comparison lib/jQuery-URL-Parser/test/purl-tests.js @ 0:b57c7821382f
initial
author | Dirk Wintergruen <dwinter@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 28 May 2015 10:28:12 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b57c7821382f |
---|---|
1 buster.spec.expose(); | |
2 | |
3 testSuite = function(url) { | |
4 it('should have a protocol of http', function() { | |
5 expect(url.attr('protocol')).toBe('http'); | |
6 }); | |
7 | |
8 it('should have a path of /folder/dir/index.html', function() { | |
9 expect(url.attr('path')).toBe('/folder/dir/index.html'); | |
10 }); | |
11 | |
12 /* should it? */ | |
13 it('should have an unset port', function() { | |
14 expect(url.attr('port')).toBe(''); | |
15 }); | |
16 | |
17 it('should have an host of allmarkedup.com', function() { | |
18 expect(url.attr('host')).toBe('allmarkedup.com'); | |
19 }); | |
20 | |
21 it('should have a relative path of /folder/dir/index.html?item=value#foo', function() { | |
22 expect(url.attr('relative')).toBe('/folder/dir/index.html?item=value#foo'); | |
23 }); | |
24 | |
25 it('should have a path of /folder/dir/index.html', function() { | |
26 expect(url.attr('path')).toBe('/folder/dir/index.html'); | |
27 }); | |
28 | |
29 it('should have a directory of /folder/dir/', function() { | |
30 expect(url.attr('directory')).toBe('/folder/dir/'); | |
31 }); | |
32 | |
33 it('should have a file of index.html', function() { | |
34 expect(url.attr('file')).toBe('index.html'); | |
35 }); | |
36 | |
37 it('should have a querystring of item=value', function() { | |
38 expect(url.attr('query')).toBe('item=value'); | |
39 }); | |
40 | |
41 it('should have an anchor of foo', function() { | |
42 expect(url.attr('anchor')).toBe('foo'); | |
43 expect(url.attr('fragment')).toBe('foo'); | |
44 }); | |
45 | |
46 it('should have a param() of item: "value"', function() { | |
47 expect(url.param()).toBeObject({item: 'value'}) | |
48 }); | |
49 | |
50 it('should have a param("item") of "value"', function() { | |
51 expect(url.param('item')).toBe('value') | |
52 }); | |
53 | |
54 it('should have a segment() of ["folder","dir","index.html"]', function() { | |
55 expect(url.segment()).toEqual(["folder","dir","index.html"]) | |
56 }); | |
57 | |
58 it('should have a segment(1) of "folder"', function() { | |
59 expect(url.segment(1)).toBe("folder"); | |
60 }); | |
61 | |
62 it('should have a segment(-1) of "folder"', function() { | |
63 expect(url.segment(-1)).toBe("index.html"); | |
64 }); | |
65 } | |
66 | |
67 describe("purl in non-strict mode", function () { | |
68 | |
69 testSuite(purl('http://allmarkedup.com/folder/dir/index.html?item=value#foo')); | |
70 | |
71 }); | |
72 | |
73 | |
74 describe("purl in strict mode", function () { | |
75 | |
76 testSuite(purl('http://allmarkedup.com/folder/dir/index.html?item=value#foo', | |
77 true)); | |
78 | |
79 }); |