Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hsp/rt/cptwrapper.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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