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 @@ -29,7 +29,7 @@
"grunt-serve": "^0.1.6",
"jquery": ">1.9.0",
"steal": "^0.16.16",
"steal-qunit": "^0.1.1",
"steal-qunit": "^2.0.0",
"steal-tools": "^0.16.4",
"testee": "^0.2.5"
},
Expand Down
10 changes: 5 additions & 5 deletions test/affix_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import $ from "jquery";

QUnit.module("bit-strap-affix view model");

QUnit.test("basics", function(){
QUnit.ok(true, 'works');
QUnit.test("basics", function(assert) {
assert.ok(true, 'works');
});

var template = can.stache("<div></div>");

QUnit.module("bit-strap-affix component",{
setup: function(){
beforeEach: function(assert) {
$("#qunit-fixture").append(template());
}
});

QUnit.test("basics", function(){
QUnit.ok(true, 'works');
QUnit.test("basics", function(assert) {
assert.ok(true, 'works');
});
48 changes: 24 additions & 24 deletions test/alert_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ QUnit.module("bitstrap-alert view model", {
}
});

QUnit.test("basics", function () {
equal( vm.attr('severity'), 'info', 'Severity defaults to "info"');
equal( vm.attr('isDismissable'), true, 'isDismissable defaults to true');
equal( vm.attr('visible'), false, 'Visible defaults to false');
equal( vm.attr('alertBody'), '', 'alertBody defaults to empty string');
equal( vm.attr('useContentTag'), true, 'useContentTag defaults to true');
equal( vm.attr('alertTitle'), '', 'alertTitle defaults to empty string');
QUnit.test("basics", function(assert) {
assert.equal( vm.attr('severity'), 'info', 'Severity defaults to "info"');
assert.equal( vm.attr('isDismissable'), true, 'isDismissable defaults to true');
assert.equal( vm.attr('visible'), false, 'Visible defaults to false');
assert.equal( vm.attr('alertBody'), '', 'alertBody defaults to empty string');
assert.equal( vm.attr('useContentTag'), true, 'useContentTag defaults to true');
assert.equal( vm.attr('alertTitle'), '', 'alertTitle defaults to empty string');
});

QUnit.test('toggling', function () {
equal( vm.attr('visible'), false, 'Visible defaults to false');
QUnit.test('toggling', function(assert) {
assert.equal( vm.attr('visible'), false, 'Visible defaults to false');
vm.toggle();
equal( vm.attr('visible'), true, 'Visible updates to true');
assert.equal( vm.attr('visible'), true, 'Visible updates to true');
});

QUnit.test('updating', function () {
equal( vm.attr('alertBody'), '', 'alertBody defaults to empty string');
equal( vm.attr('useContentTag'), true, 'useContentTag defaults to true');
QUnit.test('updating', function(assert) {
assert.equal( vm.attr('alertBody'), '', 'alertBody defaults to empty string');
assert.equal( vm.attr('useContentTag'), true, 'useContentTag defaults to true');
vm.update("TEST");
equal( vm.attr('alertBody').trim(), 'TEST', 'alertBody udpates');
equal( vm.attr('useContentTag'), false, 'useContentTag is now false');
assert.equal( vm.attr('alertBody').trim(), 'TEST', 'alertBody udpates');
assert.equal( vm.attr('useContentTag'), false, 'useContentTag is now false');
});

QUnit.module("bitstrap-alert component",{
Expand All @@ -44,21 +44,21 @@ QUnit.module("bitstrap-alert component",{
}
});

QUnit.test('renders', function () {
equal( $component.length, 1, 'Component rendered');
equal( $component.find('.alert').is(':visible'), false, 'alert is hidden' );
QUnit.test('renders', function(assert) {
assert.equal( $component.length, 1, 'Component rendered');
assert.equal( $component.find('.alert').is(':visible'), false, 'alert is hidden' );
});

QUnit.test('toggling', function () {
equal( $component.find('.alert').is(':visible'), false, 'alert is hidden' );
QUnit.test('toggling', function(assert) {
assert.equal( $component.find('.alert').is(':visible'), false, 'alert is hidden' );
vm.toggle();

equal( $component.find('.alert').is(':visible'), true, 'tooltip is visible' );
assert.equal( $component.find('.alert').is(':visible'), true, 'tooltip is visible' );
});

QUnit.test('updating', function () {
QUnit.test('updating', function(assert) {
vm.toggle();
equal( $component.find('.alert-body').text().trim(), 'HELLO', 'Alert has correct content.' );
assert.equal( $component.find('.alert-body').text().trim(), 'HELLO', 'Alert has correct content.' );
vm.update('WORLD');
equal( $component.find('.alert-body').text().trim(), 'WORLD', 'Alert updates with new content.' );
assert.equal( $component.find('.alert-body').text().trim(), 'WORLD', 'Alert updates with new content.' );
});
38 changes: 19 additions & 19 deletions test/button_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,44 @@ QUnit.module('bitstrap-button view model', {
}
});

QUnit.test('size converter', function(){
QUnit.test('size converter', function(assert) {
vm.attr('size', 'large');
QUnit.equal(vm.attr('size'), 'lg', 'large => lg');
assert.equal(vm.attr('size'), 'lg', 'large => lg');
vm.attr('size', 'small');
QUnit.equal(vm.attr('size'), 'sm', 'small => s');
assert.equal(vm.attr('size'), 'sm', 'small => s');
vm.attr('size', 'extra-small');
QUnit.equal(vm.attr('size'), 'xs', 'extra-small => xs');
assert.equal(vm.attr('size'), 'xs', 'extra-small => xs');
});

QUnit.test('Only one type true at a time', function(){
QUnit.ok(vm.attr('default'), 'default');
QUnit.test('Only one type true at a time', function(assert) {
assert.ok(vm.attr('default'), 'default');
vm.attr('type', 'success');
QUnit.ok(!vm.attr('default'), 'default is false');
QUnit.ok(vm.attr('success'), 'success is false');
assert.ok(!vm.attr('default'), 'default is false');
assert.ok(vm.attr('success'), 'success is false');
});

QUnit.test('Unrecognized type', function(){
QUnit.test('Unrecognized type', function(assert) {
vm.attr('type', 'good');
QUnit.equal(vm.attr('type'), 'default', 'returns default');
assert.equal(vm.attr('type'), 'default', 'returns default');
});

var template = can.stache('<bitstrap-button></bitstrap-button>');

QUnit.module('bitstrap-button component',{
setup: function(){
beforeEach: function(assert) {
$('#qunit-fixture').append(template());
component = $('#qunit-fixture').find('bitstrap-button');
vm = can.viewModel(component);
}
});

QUnit.test('tag types', function(){
QUnit.ok(component.find('.btn').is('button'), 'renders a <button> by default');
QUnit.test('tag types', function(assert) {
assert.ok(component.find('.btn').is('button'), 'renders a <button> by default');
vm.attr('href', '#');
QUnit.ok(component.find('.btn').is('a'), 'adding an href attribute renders an <a>');
assert.ok(component.find('.btn').is('a'), 'adding an href attribute renders an <a>');
vm.removeAttr('href');
vm.attr('value', 'Button');
QUnit.ok(component.find('.btn').is('input'), 'adding a value attribute renders an <input>');
assert.ok(component.find('.btn').is('input'), 'adding a value attribute renders an <input>');
});

QUnit.test('<button> does not submit by default', function(assert){
Expand All @@ -62,7 +62,7 @@ QUnit.test('<button> does not submit by default', function(assert){
});
$('#qunit-fixture').find('bitstrap-button .btn').click();
setTimeout(function(){
QUnit.equal(submitted, false, 'button did not submit the form');
assert.equal(submitted, false, 'button did not submit the form');
done();
}, 100);
});
Expand All @@ -77,7 +77,7 @@ QUnit.test('<button> submits', function(assert){
});
$('#qunit-fixture').find('bitstrap-button .btn').click();
setTimeout(function(){
QUnit.equal(submitted, true, 'button submitted the form');
assert.equal(submitted, true, 'button submitted the form');
done();
}, 100);
});
Expand All @@ -92,7 +92,7 @@ QUnit.test('<input> does not submit by default', function(assert){
});
$('#qunit-fixture').find('bitstrap-button .btn').click();
setTimeout(function(){
QUnit.equal(submitted, false, 'button did not submit the form');
assert.equal(submitted, false, 'button did not submit the form');
done();
}, 100);
});
Expand All @@ -107,7 +107,7 @@ QUnit.test('<input> submits', function(assert){
});
$('#qunit-fixture').find('bitstrap-button .btn').click();
setTimeout(function(){
QUnit.equal(submitted, true, 'button submitted the form');
assert.equal(submitted, true, 'button submitted the form');
done();
}, 100);
});
10 changes: 5 additions & 5 deletions test/carousel_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import $ from "jquery";

QUnit.module("bit-strap-carousel view model");

QUnit.test("basics", function(){
QUnit.ok(true, 'works');
QUnit.test("basics", function(assert) {
assert.ok(true, 'works');
});

var template = can.stache("<div></div>");

QUnit.module("bit-strap-carousel component",{
setup: function(){
beforeEach: function(assert) {
$("#qunit-fixture").append(template());
}
});

QUnit.test("basics", function(){
QUnit.ok(true, 'works');
QUnit.test("basics", function(assert) {
assert.ok(true, 'works');
});
10 changes: 5 additions & 5 deletions test/collapse_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import $ from "jquery";

QUnit.module("bit-strap-collapse view model");

QUnit.test("basics", function(){
QUnit.ok(true, 'works');
QUnit.test("basics", function(assert) {
assert.ok(true, 'works');
});

var template = can.stache("<div></div>");

QUnit.module("bit-strap-collapse component",{
setup: function(){
beforeEach: function(assert) {
$("#qunit-fixture").append(template());
}
});

QUnit.test("basics", function(){
QUnit.ok(true, 'works');
QUnit.test("basics", function(assert) {
assert.ok(true, 'works');
});
30 changes: 15 additions & 15 deletions test/dropdown_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ QUnit.module("bit-strap-dropdown view model", {
}
});

QUnit.test("basics", function(){
equal( vm.attr('items').length, 0, 'Items is empty array');
equal( vm.attr('visible'), false, 'Visible defaults to false');
equal( vm.attr('buttonName'), '', 'Button');
equal( vm.attr('dropdownId').indexOf('dropdown'), 0, 'Dropdow ID default is prefixed with dropdown');
equal( vm.attr('alignment'),'left', 'Alignment defualts to left.');
QUnit.test("basics", function(assert) {
assert.equal( vm.attr('items').length, 0, 'Items is empty array');
assert.equal( vm.attr('visible'), false, 'Visible defaults to false');
assert.equal( vm.attr('buttonName'), '', 'Button');
assert.equal( vm.attr('dropdownId').indexOf('dropdown'), 0, 'Dropdow ID default is prefixed with dropdown');
assert.equal( vm.attr('alignment'),'left', 'Alignment defualts to left.');
});


Expand All @@ -34,16 +34,16 @@ QUnit.module("bit-strap-dropdown component",{
}
});

QUnit.test("basics", function(){
equal( $component.find('.dropdown').is(':visible'), true, 'Dropdown container is visible' );
equal( $component.find('.dropdown-toggle').is(':visible'), true, 'Dropdown button is visible' );
equal( $component.find('.dropdown-menu').is(':visible'), false, 'Dropdown menu options are not visible' );
QUnit.test("basics", function(assert) {
assert.equal( $component.find('.dropdown').is(':visible'), true, 'Dropdown container is visible' );
assert.equal( $component.find('.dropdown-toggle').is(':visible'), true, 'Dropdown button is visible' );
assert.equal( $component.find('.dropdown-menu').is(':visible'), false, 'Dropdown menu options are not visible' );
});

QUnit.test('toggle', function () {
equal( $component.find('.dropdown-menu').is(':visible'), false, 'Dropdown menu options are hidden' );
QUnit.test('toggle', function(assert) {
assert.equal( $component.find('.dropdown-menu').is(':visible'), false, 'Dropdown menu options are hidden' );
$component.find('.dropdown-toggle').click();
equal( $component.find('.dropdown-menu').is(':visible'), true, 'Dropdown menu options is visible' );
equal( $component.find('.dropdown-menu-item').length, 2, 'Dropdown menu renders all items' );
equal( $component.find('.dropdown-menu-item').eq(0).text(), 'test', 'Dropdown menu item renders text' );
assert.equal( $component.find('.dropdown-menu').is(':visible'), true, 'Dropdown menu options is visible' );
assert.equal( $component.find('.dropdown-menu-item').length, 2, 'Dropdown menu renders all items' );
assert.equal( $component.find('.dropdown-menu-item').eq(0).text(), 'test', 'Dropdown menu item renders text' );
});
42 changes: 21 additions & 21 deletions test/modal_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ QUnit.module("bitstrap-modal view model", {
}
});

QUnit.test("basics", function () {
equal( vm.attr('visible'), false, 'Visible defaults to false');
equal( vm.attr('modalTitle'), '', 'Title defaults to empty string.');
equal( vm.attr('modalSize'), '', 'Size defaults to empty string.');
equal( vm.attr('isModal'), true, 'Is modal by default.');
equal( vm.attr('isHidden'), true, 'isHidden flips visible');
QUnit.test("basics", function(assert) {
assert.equal( vm.attr('visible'), false, 'Visible defaults to false');
assert.equal( vm.attr('modalTitle'), '', 'Title defaults to empty string.');
assert.equal( vm.attr('modalSize'), '', 'Size defaults to empty string.');
assert.equal( vm.attr('isModal'), true, 'Is modal by default.');
assert.equal( vm.attr('isHidden'), true, 'isHidden flips visible');
});


Expand All @@ -30,28 +30,28 @@ QUnit.module("bitstrap-modal component",{
}
});

QUnit.test('renders', function () {
equal( $component.length, 1, 'Component rendered');
equal( $component.find('.modal').is(':visible'), false, 'Modal is hidden' );
QUnit.test('renders', function(assert) {
assert.equal( $component.length, 1, 'Component rendered');
assert.equal( $component.find('.modal').is(':visible'), false, 'Modal is hidden' );
});

QUnit.test('toggles', function () {
QUnit.test('toggles', function(assert) {
vm.attr('visible', true);
equal( $component.find('.modal').is(':visible'), true, 'Modal is visible' );
equal( $component.find('.modal-backdrop').is(':visible'), true, 'Modal is visible' );
equal( $('body').hasClass('modal-open'), true, 'Class added to body' );
assert.equal( $component.find('.modal').is(':visible'), true, 'Modal is visible' );
assert.equal( $component.find('.modal-backdrop').is(':visible'), true, 'Modal is visible' );
assert.equal( $('body').hasClass('modal-open'), true, 'Class added to body' );
vm.attr('visible', false);
equal( $component.find('.modal').is(':visible'), false, 'Modal is hidden' );
equal( $component.find('.modal-backdrop').is(':visible'), false, 'Modal is visible' );
equal( $('body').hasClass('modal-open'), false, 'Class removed from body' );
assert.equal( $component.find('.modal').is(':visible'), false, 'Modal is hidden' );
assert.equal( $component.find('.modal-backdrop').is(':visible'), false, 'Modal is visible' );
assert.equal( $('body').hasClass('modal-open'), false, 'Class removed from body' );
});

QUnit.test('header', function () {
equal( $component.find('.modal-header').length, 0, 'Header is not rendered' );
QUnit.test('header', function(assert) {
assert.equal( $component.find('.modal-header').length, 0, 'Header is not rendered' );

vm.attr('modalTitle', 'test');
vm.attr('visible', true);
equal( $component.find('.modal-header').length, 1, 'Header is rendered' );
equal( $component.find('.modal-header').is(':visible'), true, 'Header is visible' );
equal( $component.find('.modal-title').text(), 'test', 'Modal title is rendered' );
assert.equal( $component.find('.modal-header').length, 1, 'Header is rendered' );
assert.equal( $component.find('.modal-header').is(':visible'), true, 'Header is visible' );
assert.equal( $component.find('.modal-title').text(), 'test', 'Modal title is rendered' );
});
22 changes: 11 additions & 11 deletions test/panel_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ QUnit.module("bitstrap-panel view model", {
}
});

QUnit.test("basics", function () {
equal( vm.attr('panelTitle'), '', 'Title defaults to empty string');
equal( vm.attr('panelFooter'), '', 'Footer defaults to empty string');
equal( vm.attr('classes'), 'panel-default', 'Panel class list defaults to \'panel-default\'');
QUnit.test("basics", function(assert) {
assert.equal( vm.attr('panelTitle'), '', 'Title defaults to empty string');
assert.equal( vm.attr('panelFooter'), '', 'Footer defaults to empty string');
assert.equal( vm.attr('classes'), 'panel-default', 'Panel class list defaults to \'panel-default\'');
});

QUnit.module("bitstrap-panel component",{
Expand All @@ -27,11 +27,11 @@ QUnit.module("bitstrap-panel component",{
}
});

QUnit.test('renders', function () {
equal( $component.length, 1, 'Component rendered');
equal( $component.find('.panel-body').is(':visible'), true, 'Panel body is visible' );
equal( $component.find('.panel-body').text().trim(), 'TEST', 'Panel body content renders.' );
equal( $component.find('.panel-heading').text().trim(), 'HEYO', 'Panel header content renders.' );
equal( $component.find('.panel-footer').text(), 'AUSTIN', 'Panel footer content renders.' );
equal( $component.find('.panel').hasClass('panel-warning'), true, 'Panel gets correct contextual class.' );
QUnit.test('renders', function(assert) {
assert.equal( $component.length, 1, 'Component rendered');
assert.equal( $component.find('.panel-body').is(':visible'), true, 'Panel body is visible' );
assert.equal( $component.find('.panel-body').text().trim(), 'TEST', 'Panel body content renders.' );
assert.equal( $component.find('.panel-heading').text().trim(), 'HEYO', 'Panel header content renders.' );
assert.equal( $component.find('.panel-footer').text(), 'AUSTIN', 'Panel footer content renders.' );
assert.equal( $component.find('.panel').hasClass('panel-warning'), true, 'Panel gets correct contextual class.' );
});
Loading