1.2.0 • Published 8 years ago

chai-jskit v1.2.0

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
8 years ago

Chai-JSkit

This is a simple chai plugin to make testing jskit applications.

Testing Actions

// controller:
...
actions: ["index"],
...

// expectation:
expect(subject).to.have.action("index");
// controller:
...
actions: [{ edit: "setupForm" }],
...

// expectation:
expect(subject).to.have.action("edit", "setupForm");

Testing Elements

// controller:
...
elements: {
    index: {
        menuToggleButton: ".menu-toggle"
    }
}
...

// expectation:
expect(subject).to.cacheElement("index", "$menuToggleButton", ".menu-toggle");

Testing Events

// controller:
...
elements: {
  index: {
    todoListItem: [".todo-list-item", { click: "handleTodoListClick" }]
  }
},
...
handleTodoListClick: function() {},

// expectation:
expect(subject).to.registerEvent("index", "$todoListItem", "click", "handleTodoListClick");

Dynamic event binding:

// controller:
...
elements: {
  index: {
    todoListItem: [".todo-list-item", function() {
        on("click", this.handleTodoListClick);
    }]
  }
},
...
handleTodoListClick: function() {},

// expectation:
expect(subject).to.registerEvent("index", "$todoListItem", "click", "handleTodoListClick");
1.2.0

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago