Skip to content

Commit

Permalink
add tests for errors when data isn't a function in components
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Sep 27, 2017
1 parent 85d155e commit f888763
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
17 changes: 17 additions & 0 deletions test/core/component/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@ describe("Component", function() {
});
});

it("should error when data is not a function", function() {
var fail = false;
console.error = function() {
fail = true;
console.error = noop;
}

Moon.extend("data-function-fail", {
template: "<h1>Hello Moon!</h1>",
data: {}
});

return wait(function() {
expect(fail).to.be["true"];
});
});

describe("Mounting", function() {
it("should mount when replaced", function() {
var mountComponentReplace = createTestElement("mountComponentReplace", "<h1>Test</h1><component m-if='condition'></component>");
Expand Down
10 changes: 5 additions & 5 deletions test/core/instance/mount.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('Mount', function() {
it('when mounted on a selector', function() {
var mountSelector = createTestElement("mountSelector", '{{msg}}');
describe("Mount", function() {
it("when mounted on a selector", function() {
var mountSelector = createTestElement("mountSelector", "{{msg}}");

new Moon({
root: "#mountSelector",
Expand All @@ -14,8 +14,8 @@ describe('Mount', function() {
});
});

it('when mounted on an element', function() {
var mountElement = createTestElement("mountElement", '{{msg}}');
it("when mounted on an element", function() {
var mountElement = createTestElement("mountElement", "{{msg}}");

new Moon({
root: mountElement,
Expand Down

0 comments on commit f888763

Please sign in to comment.