]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | describe("Ext.data.proxy.LocalStorage", function() {\r |
2 | var proxy;\r | |
3 | \r | |
4 | if (Ext.supports.LocalStorage) {\r | |
5 | beforeEach(function() {\r | |
6 | Ext.ClassManager.enableNamespaceParseCache = false;\r | |
7 | proxy = new Ext.data.proxy.LocalStorage({id: 1});\r | |
8 | });\r | |
9 | \r | |
10 | afterEach(function() {\r | |
11 | Ext.ClassManager.enableNamespaceParseCache = true;\r | |
12 | });\r | |
13 | \r | |
14 | describe("instantiation", function() {\r | |
15 | it("should extend Ext.data.proxy.WebStorage", function() {\r | |
16 | expect(proxy.superclass).toEqual(Ext.data.proxy.WebStorage.prototype);\r | |
17 | });\r | |
18 | });\r | |
19 | \r | |
20 | describe("methods", function() {\r | |
21 | describe("getStorageObject", function() {\r | |
22 | it("should return localStorage object", function() {\r | |
23 | // IE8 throw Class doesn't support Automation when comparing localStorage to itself (or sessionStorage)\r | |
24 | var automationBug = false;\r | |
25 | try {\r | |
26 | localStorage === localStorage;\r | |
27 | } catch(e) {\r | |
28 | automationBug = true;\r | |
29 | }\r | |
30 | if (!automationBug) {\r | |
31 | expect(proxy.getStorageObject()).toEqual(localStorage);\r | |
32 | } else { \r | |
33 | var storageObject = proxy.getStorageObject();\r | |
34 | expect(window.localStorage.setItem === storageObject.setItem).toBe(true);\r | |
35 | }\r | |
36 | });\r | |
37 | });\r | |
38 | });\r | |
39 | } else {\r | |
40 | describe("instantiation", function() {\r | |
41 | it("should throw an error", function() {\r | |
42 | expect(function() {\r | |
43 | new Ext.data.proxy.LocalStorage({id: 1});\r | |
44 | }).toRaiseExtError("Local Storage is not supported in this browser, please use another type of data proxy");\r | |
45 | });\r | |
46 | });\r | |
47 | }\r | |
48 | });\r |