source:
trunk/workshop-routing-foss4g/web/ext/test/unit/direct/Direct.js
@
77
Revision 76, 2.5 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /*! |
2 | * Ext JS Library 3.4.0 |
3 | * Copyright(c) 2006-2011 Sencha Inc. |
4 | * licensing@sencha.com |
5 | * http://www.sencha.com/license |
6 | */ |
7 | /** |
8 | * Tests Ext.data.Store functionality |
9 | * @author Ed Spencer |
10 | */ |
11 | (function() { |
12 | var suite = Ext.test.session.getSuite('Ext.Direct'), |
13 | assert = Y.Assert; |
14 | |
15 | //a shared setup function used by several of the suites |
16 | var defaultSetup = function() { |
17 | this.API = { |
18 | "url": "php\/router.php", |
19 | "type": "remoting", |
20 | "actions": { |
21 | "TestAction": [{ |
22 | "name": "doEcho", |
23 | "len": 1 |
24 | }, { |
25 | "name": "multiply", |
26 | "len": 1 |
27 | }, { |
28 | "name": "getTree", |
29 | "len": 1 |
30 | }], |
31 | "Profile": [{ |
32 | "name": "getBasicInfo", |
33 | "len": 2 |
34 | }, { |
35 | "name": "getPhoneInfo", |
36 | "len": 1 |
37 | }, { |
38 | "name": "getLocationInfo", |
39 | "len": 1 |
40 | }, { |
41 | "name": "updateBasicInfo", |
42 | "len": 2, |
43 | "formHandler": true |
44 | }] |
45 | } |
46 | }; |
47 | }; |
48 | |
49 | suite.add(new Y.Test.Case({ |
50 | name: 'adding providers', |
51 | |
52 | setUp: defaultSetup, |
53 | |
54 | testAddProvider: function() { |
55 | var p = Ext.Direct.addProvider( |
56 | this.API |
57 | ); |
58 | Y.ObjectAssert.hasKeys(p.actions, [ |
59 | "Profile", |
60 | "TestAction" |
61 | ], 'Test actions provided'); |
62 | Y.ObjectAssert.hasKeys(p.actions, p, Ext.Direct.providers, "Test providers cache"); |
63 | }, |
64 | testGetProvider: function() { |
65 | var p = Ext.Direct.addProvider( |
66 | this.API |
67 | ); |
68 | Y.ObjectAssert.hasKeys(p, Ext.Direct.getProvider(p.id)); |
69 | }, |
70 | testRemoveProvider: function() { |
71 | // Remove via id |
72 | var p = Ext.Direct.addProvider( |
73 | this.API |
74 | ); |
75 | var id = p.id; |
76 | Ext.Direct.removeProvider(id); |
77 | Y.Assert.isUndefined(Ext.Direct.getProvider(id)); |
78 | |
79 | // Remove via object |
80 | var p = Ext.Direct.addProvider( |
81 | this.API |
82 | ); |
83 | var id = p.id; |
84 | Ext.Direct.removeProvider(p); |
85 | Y.Assert.isUndefined(Ext.Direct.getProvider(id)); |
86 | } |
87 | })); |
88 | })(); |
Note: See TracBrowser
for help on using the repository browser.