Browse Source

Fix update content inside Modal module

pull/36/head
Artur Arseniev 10 years ago
parent
commit
989bd23887
  1. 2
      src/modal_dialog/main.js
  2. 4
      src/modal_dialog/view/ModalView.js
  3. 2
      test/specs/modal/view/ModalView.js

2
src/modal_dialog/main.js

@ -109,7 +109,7 @@ define(function(require) {
/** /**
* Set content of the modal window * Set content of the modal window
* @param {string} content Content * @param {string|HTMLElement} content Content
* @return {this} * @return {this}
* @example * @example
* modal.setContent('<div>Some HTML content</div>'); * modal.setContent('<div>Some HTML content</div>');

4
src/modal_dialog/view/ModalView.js

@ -28,7 +28,7 @@ define(['backbone', 'text!./../template/modal.html'],
getContent: function(){ getContent: function(){
if(!this.$content) if(!this.$content)
this.$content = this.$el.find('.'+this.pfx+'content #'+this.pfx+'c'); this.$content = this.$el.find('.'+this.pfx+'content #'+this.pfx+'c');
return this.$content.get(0); return this.$content;
}, },
/** /**
@ -49,7 +49,7 @@ define(['backbone', 'text!./../template/modal.html'],
updateContent: function(){ updateContent: function(){
var content = this.getContent(); var content = this.getContent();
if(content) if(content)
content.innerHTML = this.model.get('content'); content.html(this.model.get('content'));
}, },
/** /**

2
test/specs/modal/view/ModalView.js

@ -45,7 +45,7 @@ define([path + 'ModalView', 'ModalDialog/model/Modal'],
it("Update content", function (){ it("Update content", function (){
model.set('content', 'test'); model.set('content', 'test');
view.getContent().innerHTML.should.equal('test'); view.getContent().get(0).innerHTML.should.equal('test');
}); });
it("Get title", function (){ it("Get title", function (){

Loading…
Cancel
Save