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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"generator-donejs": "^1.0.0-alpha.0",
"jshint": "^2.9.1",
"steal": "^1.0.5",
"steal-qunit": "^1.0.0",
"steal-qunit": "^2.0.0",
"steal-tools": "^1.0.1",
"testee": "^0.3.0"
}
Expand Down
40 changes: 20 additions & 20 deletions test/attributes-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ function fixture(){
}

QUnit.module("can-custom-elements attributes", {
teardown: function(){
afterEach: function(assert) {
fixture().innerHTML = "";
}
});

QUnit.test("can tag a property as an attribute", function(){
QUnit.test("can tag a property as an attribute", function(assert) {
var view = stache("{{foo}}");

var AttrEl = class extends CanElement {
Expand All @@ -40,22 +40,22 @@ QUnit.test("can tag a property as an attribute", function(){
var el = new AttrEl();
el.foo = "bar";

QUnit.equal(el.getAttribute("foo"), "bar", "setting the property set the attribute as well");
assert.equal(el.getAttribute("foo"), "bar", "setting the property set the attribute as well");

QUnit.equal(el.foo, "bar", "the property too");
assert.equal(el.foo, "bar", "the property too");

el.setAttribute("foo", "baz");

helpers.soon(function(){
QUnit.equal(el.getAttribute("foo"), "baz", "attr is now baz");
QUnit.equal(el.foo, "baz", "prop is now baz");
QUnit.start();
assert.equal(el.getAttribute("foo"), "baz", "attr is now baz");
assert.equal(el.foo, "baz", "prop is now baz");
done();
});

QUnit.stop();
var done = assert.async();
});

QUnit.test("Can use 'type' to modify the type on the property", function(){
QUnit.test("Can use 'type' to modify the type on the property", function(assert) {
var view = stache("{{one}}");

var AttrEl = class extends CanElement {
Expand All @@ -78,15 +78,15 @@ QUnit.test("Can use 'type' to modify the type on the property", function(){
el.setAttribute("num", "15");

helpers.soon(function(){
QUnit.deepEqual(el.getAttribute("num"), "15");
QUnit.deepEqual(el.num, 15, "the property is a number");
QUnit.start();
assert.deepEqual(el.getAttribute("num"), "15");
assert.deepEqual(el.num, 15, "the property is a number");
done();
});

QUnit.stop();
var done = assert.async();
});

QUnit.test("Properties are observable", function(){
QUnit.test("Properties are observable", function(assert) {
var view = stache("{{foo}}");

var AttrEl = class extends CanElement {
Expand All @@ -107,17 +107,17 @@ QUnit.test("Properties are observable", function(){
return el.foo;
});

QUnit.equal(fooCompute(), el.foo, "same initial value");
assert.equal(fooCompute(), el.foo, "same initial value");

fooCompute.bind("change", function(){
QUnit.ok(true, "change event occurred");
QUnit.start();
assert.ok(true, "change event occurred");
done();
});

QUnit.stop();
var done = assert.async();

// Change it
el.foo = "bar";
QUnit.equal(el.foo, "bar");
QUnit.equal(fooCompute(), "bar", "compute updated too");
assert.equal(el.foo, "bar");
assert.equal(fooCompute(), "bar", "compute updated too");
});
38 changes: 19 additions & 19 deletions test/es6-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ function fixture(){
}

QUnit.module("can-custom-elements ES6", {
teardown: function() {
afterEach: function(assert) {
fixture().innerHTML = "";
}
});

QUnit.test("Absolute basics", function(){
QUnit.test("Absolute basics", function(assert) {
var view = stache("hello {{name}}");

class MyApp extends CanElement {
Expand All @@ -42,18 +42,18 @@ QUnit.test("Absolute basics", function(){
helpers.soon(function(){
var myApp = fixture().querySelector("my-app");

QUnit.equal(myApp.name, "world");
QUnit.ok(myApp instanceof HTMLElement);
assert.equal(myApp.name, "world");
assert.ok(myApp instanceof HTMLElement);

QUnit.equal(myApp.shadowRoot.textContent, "hello world");
assert.equal(myApp.shadowRoot.textContent, "hello world");

QUnit.start();
done();
});

QUnit.stop();
var done = assert.async();
});

QUnit.test("Can pass data to child components", function(){
QUnit.test("Can pass data to child components", function(assert) {
var parentView = stache("<child-one {foo}='bar'/>");
var childView = stache("{{foo}}");

Expand Down Expand Up @@ -88,16 +88,16 @@ QUnit.test("Can pass data to child components", function(){

helpers.soon(function(){
var child = parent.shadowRoot.querySelector("child-one");
QUnit.equal(child.foo, "bar", "data was passed from parent to child");
QUnit.equal(child.shadowRoot.textContent, "bar",
assert.equal(child.foo, "bar", "data was passed from parent to child");
assert.equal(child.shadowRoot.textContent, "bar",
"content was rendered correctly");
QUnit.start();
done();
});

QUnit.stop();
var done = assert.async();
});

QUnit.test("Gets data from the passed in scope", function(){
QUnit.test("Gets data from the passed in scope", function(assert) {
var view = stache("{{foo}}");

var MyComponent = class extends CanElement {
Expand All @@ -120,12 +120,12 @@ QUnit.test("Gets data from the passed in scope", function(){
helpers.soon(function(){
var el = fixture().querySelector("data-from-scope");

QUnit.equal(el.foo, "bar", "got data from the scope");
QUnit.equal(el.shadowRoot.textContent, "bar");
QUnit.start();
assert.equal(el.foo, "bar", "got data from the scope");
assert.equal(el.shadowRoot.textContent, "bar");
done();
});

QUnit.stop();
var done = assert.async();
});

QUnit.skip("DOM events work when can-defined", function(){
Expand All @@ -149,8 +149,8 @@ QUnit.skip("DOM events work when can-defined", function(){
el.addEventListener("some-event", inc);

el.foo = "bar";
QUnit.equal(events, 1, "one event");
assert.equal(events, 1, "one event");

domDispatch.call(el, "some-event");
QUnit.equal(events, 2, "two events");
assert.equal(events, 2, "two events");
});