]> git.proxmox.com Git - extjs.git/blob - extjs/classic/classic/test/specs/panel/Table.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / test / specs / panel / Table.js
1 describe("Ext.panel.Table", function () {
2 var createGrid = function (storeCfg, gridCfg) {
3 store = Ext.create('Ext.data.Store', Ext.apply({
4 storeId:'simpsonsStore',
5 fields:['name', 'email', 'phone'],
6 data:{'items':[
7 { 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" },
8 { 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" },
9 { 'name': 'Homer', "email":"homer@simpsons.com", "phone":"555-222-1244" },
10 { 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" }
11 ]},
12 proxy: {
13 type: 'memory',
14 reader: {
15 type: 'json',
16 rootProperty: 'items'
17 }
18 }
19 }, storeCfg));
20
21 grid = Ext.create('Ext.grid.Panel', Ext.apply({
22 title: 'Simpsons',
23 store: store,
24 columns: [
25 { header: 'Name', dataIndex: 'name', width: 100 },
26 { header: 'Email', dataIndex: 'email', flex: 1 },
27 { header: 'Phone', dataIndex: 'phone', flex: 1, hidden: true }
28 ],
29 height: 200,
30 width: 400
31 }, gridCfg));
32 },
33 store, grid;
34
35 afterEach(function(){
36 Ext.destroy(grid);
37 grid = null;
38 });
39
40 describe('forceFit', function () {
41 it('should let the headerCt know it is part of a forceFit grid when header is a grid config', function () {
42 createGrid({}, {
43 forceFit: true
44 });
45
46 expect(grid.forceFit).toBe(true);
47 expect(grid.headerCt.forceFit).toBe(true);
48 });
49
50 it('should let the headerCt know it is part of a forceFit grid when header is an instance', function () {
51 createGrid({}, {
52 forceFit: true,
53 columns: new Ext.grid.header.Container({
54 items: [
55 { header: 'Name', dataIndex: 'name', width: 100 },
56 { header: 'Email', dataIndex: 'email', flex: 1 },
57 { header: 'Phone', dataIndex: 'phone', flex: 1, hidden: true }
58 ]
59 })
60 });
61
62 expect(grid.forceFit).toBe(true);
63 expect(grid.headerCt.forceFit).toBe(true);
64 });
65 });
66 });