Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append a modal to .ember-application #37

Merged
merged 1 commit into from
Oct 4, 2012
Merged
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
8 changes: 5 additions & 3 deletions packages/ember-bootstrap/lib/views/modal_pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ Bootstrap.ModalPane = Ember.View.extend({
destroy = this.callback(options, event);
}
if (destroy === undefined || destroy) this.destroy();
}
}
});

Bootstrap.ModalPane.reopenClass({
rootElement: ".ember-application",
popup: function(options) {
var modalPane;
var modalPane, rootElement;
if (!options) options = {};
modalPane = this.create(options);
modalPane.append();
rootElement = get(this, 'rootElement');
modalPane.appendTo(rootElement);
return modalPane;
}
});
Expand Down
10 changes: 10 additions & 0 deletions packages/ember-bootstrap/tests/views/modal_pane_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ test("a modal pane can be created and appended to DOM using popup() call", funct
ok(isAppendedToDOM(modalPane), 'a modal pane has a layer in the DOM');
});

test("a modal pane is appended to the application using popup() call", function() {
application.destroy();
var rootElement = Ember.$('<div id="app" />').appendTo('#qunit-fixture');
application = Ember.Application.create({rootElement: "#app"});
Ember.run(function() {
modalPane = Bootstrap.ModalPane.popup();
});
ok((rootElement.find(modalPane.$()).length), 'a modal pane is appended to the application');
});

test("a modal pane can be created and appended to DOM", function() {
modalPane = Bootstrap.ModalPane.create();
appendIntoDOM(modalPane);
Expand Down