Skip to content

Commit

Permalink
Merge d21c2ad into af878ff
Browse files Browse the repository at this point in the history
  • Loading branch information
marclaval committed Sep 17, 2014
2 parents af878ff + d21c2ad commit fbcb3de
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hsp/rt/cptwrapper.js
Expand Up @@ -45,7 +45,7 @@ var ATTRIBUTE_TYPES = {
"string" : {
defaultValue : '',
convert : function (v, attcfg) {
return v + '';
return v != null? v + '': v;
}
},
"object" : {
Expand Down
25 changes: 24 additions & 1 deletion test/rt/cptattelements1.spec.hsp
Expand Up @@ -102,7 +102,7 @@ PanelController = klass({

var TestCtl=klass({
attributes:{
"value":{type:"string",binding:"1-way"}
"value":{type:"string",binding:"1-way", defaultValue: "abc"}
}
})

Expand Down Expand Up @@ -283,6 +283,27 @@ describe("Component attribute elements (1)", function () {
h.$dispose();
});

it("tests issue #164 - Attributes of type string should contain null when the bound value is null", function() {
var h=ht.newTestContext();
var m={prop:{value: null}};
test7(m).render(h.container);

expect(h(".content").text()).to.equal("Value:");

h.$dispose();
});

//TODO: fix this test or remove it if not valid
/*it("tests issue #164 - Attributes of type string contain string defaultValue when the bound value is undefined", function() {
var h=ht.newTestContext();
var m={prop:{}};
test7(m).render(h.container);

expect(h(".content").text()).to.equal("Value:abc");

h.$dispose();
});*/

it("tests invalid component content", function() {
var h=ht.newTestContext();
var m={panel:panel,text:"Hello World"}
Expand All @@ -296,6 +317,8 @@ describe("Component attribute elements (1)", function () {
h.$dispose();
});



// TODO
// properly dispose generated properties
// test errors when sub-template attribute are improperly mixed
Expand Down

0 comments on commit fbcb3de

Please sign in to comment.