Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/ext/test/unit/widgets/GridPanel.js @ 76

Revision 76, 3.3 KB checked in by djay, 12 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
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.grid.GridPanel'),
13        assert = Y.Assert;
14   
15    //builds and returns a grid with some default config
16    var buildGrid = function(config) {
17        config = config || {};
18             
19        Ext.applyIf(config, {
20            store: new Ext.data.ArrayStore({
21                autoDestroy: true,
22               
23                storeId: 'myStore',
24                idIndex: 0, 
25                fields : [
26                   'company',
27                   {name: 'price',      type: 'float'},
28                   {name: 'change',     type: 'float'},
29                   {name: 'pctChange',  type: 'float'},
30                   {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
31                ],
32               
33                data: [
34                    ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
35                    ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
36                    ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
37                    ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
38                    ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
39                ]
40            }),
41           
42            colModel: new Ext.grid.ColumnModel({
43                columns: [
44                    {header: 'Name', dataIndex: 'company'}
45                ]
46            }),
47           
48            selModel: new Ext.grid.RowSelectionModel()
49        });
50       
51        return new Ext.grid.GridPanel(config);
52    };
53       
54    suite.add(new Y.Test.Case({
55        name: 'constructor and initComponent',
56       
57        testDisallowsAutoScroll: function() {
58            var grid = buildGrid({autoScroll: true});
59           
60            assert.isFalse(grid.autoScroll);
61        },
62       
63        testDisallowsAutoWidth: function() {
64            var grid = buildGrid({autoWidth: true});
65           
66            assert.isFalse(grid.autoWidth);
67        },
68       
69        testDsTranslatedToStore: function() {
70            var store = new Ext.data.ArrayStore({fields: ['name']}),
71                grid  = buildGrid({ds: store, store: null});
72           
73            assert.areEqual(store, grid.store);
74            assert.isUndefined(grid.ds);
75        },
76       
77        testCmTranslatedToColModel: function() {
78            var colModel = new Ext.grid.ColumnModel({columns: [{header: 'my header'}]}),
79                grid     = buildGrid({cm: colModel, colModel: null});
80           
81            assert.areEqual(colModel, grid.colModel);
82            assert.isUndefined(grid.cm);
83        },
84       
85        testColumnsTurnedIntoColModel: function() {
86            var columns = [
87                {header: 'first', dataIndex: 'company'}, {header: 'second', dataIndex: 'price'}
88            ];
89            var grid = buildGrid({columns: columns, colModel: null});
90           
91            var colModel = grid.colModel;
92            assert.areEqual(2, colModel.getColumnCount());
93        }
94    }));
95   
96    suite.add(new Y.Test.Case({
97        name: 'reconfigure'
98    }));
99   
100    suite.add(new Y.Test.Case({
101        name: 'walk cells'
102    }));
103})();
Note: See TracBrowser for help on using the repository browser.