Sha256: 0f3ee21eb92b04c49cc4d5f8a4f4ee03295e18fc8b283ec9b8563742a0eece42

Contents?: true

Size: 1.8 KB

Versions: 4

Compression:

Stored size: 1.8 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*globals module ok equals same test Sample */
var basic, baseTypes, bindingPage, testView, design;


module('SC.DesignCoder', {
  setup: function () {
    basic = SC.Page.design({});
    testView = SC.View.extend({});
    testView.Designer = SC.ViewDesigner.extend({
      designProperties: 's n b a h valueBinding'.w()
    });
    
    
    baseTypes = SC.Page.create({
      needsDesigner: true,
      mainView: testView.design({s:'string',n:12,b:false,a:[1, 2, 3],h:{a:'b',c:'d'}})
    });
      
    bindingPage = SC.Page.create({
      number: 12,
      needsDesigner: true,
      mainView: testView.design({valueBinding: SC.Binding.from('.page.number')})//.create() //to get it to run on the binding itself...
    });
    
  },

  teardown: function () {
  }
});

test('Verify basic page file encoding', function () {
  design = SC.DesignCoder.encode(basic);
  equals(design.trim(), 'SC.Page.design({})', 'basic page encoded');
});

test('Verify view in page encoding', function () {
  baseTypes.awake();
  design = SC.DesignCoder.encode(baseTypes);
  equals(design.trim(),'SC.Page.design({mainView: SC.View.design({s: "string",n: 12,b: false,a: [1,2,3],h: {"a": "b","c": "d"}})})', 'basic types encoded');  
});

test('Verify binding in page encoding', function () {
  SC.RunLoop.begin();
  bindingPage.awake();
  bindingPage.get('mainView');
  SC.RunLoop.end();

  design = SC.DesignCoder.encode(bindingPage);
  equals(design.trim(),'SC.Page.design({mainView: SC.View.design({valueBinding: SC.Binding.from(\'.page.number\')})})', 'binding types encoded');  
});

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
sproutcore-1.5.0.rc.2 lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js
sproutcore-1.5.0.rc.1 lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js
spade-0.0.1 sproutcore/frameworks/designer/tests/coders/page.js
sproutcore-1.5.0.pre.5 lib/frameworks/sproutcore/frameworks/designer/tests/coders/page.js