forked from patternfly/patternfly-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* introduce Patternfly js libraries to Karma * provide smoke test examples for running unit tests on Patternfly test fixtures * removes any inline scripts from fixtures during Karma testing, and sources Karma scripts instead * adds grunt-karma * adds automated test examples for the following components: + About Modal + Accordion + Alerts + Area Charts + Badges + Bar Charts + Bootstrap Combobox + Bootstrap Datepicker + Bootstrap Select + Bootstrap Switch + Bootstrap Treeview + Datatables
- Loading branch information
patrickriley
committed
Jul 15, 2016
1 parent
2dd93a4
commit 3f44276
Showing
17 changed files
with
430 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
describe("about-modal suite", function () { | ||
|
||
beforeEach(function () { | ||
globals.readFixture(globals.fixturePath + 'about-modal.html'); | ||
}); | ||
|
||
it('should launch the about modal', function (done) { | ||
var button = $('button[data-toggle="modal"]'); | ||
var modal = $('.modal'); | ||
|
||
//expect modal to be hidden initially | ||
expect(modal).toBeHidden(); | ||
|
||
button.click(); | ||
|
||
setTimeout(function () { | ||
expect(modal).not.toBeHidden(); | ||
done(); | ||
}, globals.wait); | ||
}); | ||
|
||
it('should close the about modal and the backdrop should disappear', function (done) { | ||
var closeButton = $('button.close'); | ||
|
||
closeButton.click(); | ||
|
||
setTimeout(function () { | ||
expect($('.modal')).toBeHidden(); | ||
|
||
//manually remove backdrop | ||
$('.modal-backdrop').remove(); | ||
done(); | ||
}, globals.wait); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
describe("badges test suite", function () { | ||
|
||
beforeEach(function () { | ||
loadFixtures(globals.fixturePath + 'badges.html'); | ||
globals.readFixture(globals.fixturePath + 'badges.html'); | ||
}); | ||
|
||
it('should contain a button with a badge span element', function (done) { | ||
it('should contain a button with a badge span element', function () { | ||
var button = $('button'); | ||
var span = $('button span.badge'); | ||
|
||
setTimeout(function () { | ||
expect(button).toExist(); | ||
expect(span).toHaveClass('badge'); | ||
done(); | ||
}, globals.wait); | ||
expect(button).toExist(); | ||
expect(span).toHaveClass('badge'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
describe("bootstrap-combobox test suite", function () { | ||
|
||
beforeAll(function () { | ||
globals.readFixture(globals.fixturePath + 'bootstrap-combobox.html'); | ||
|
||
//render the combobox using the plugin | ||
$('.combobox').combobox(); | ||
}); | ||
|
||
|
||
it('should use the plugin to take the first select element and render a menu list with 51 items', function (done) { | ||
var select = $('select.combobox:first'); | ||
var toggle = $('.dropdown-toggle:first'); | ||
|
||
toggle.click(); | ||
|
||
setTimeout(function () { | ||
var renderedMenuList = select.siblings().find('div.input-group ul li'); | ||
expect(renderedMenuList).toHaveLength(51); | ||
done(); | ||
}, globals.wait); | ||
}); | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
describe("bootstrap datepicker test suite", function () { | ||
|
||
beforeEach(function () { | ||
globals.readFixture(globals.fixturePath + 'bootstrap-datepicker.html'); | ||
}); | ||
|
||
it('should open the first datepicker after show', function (done) { | ||
|
||
var datePicker1 = $('#datepicker1'); | ||
|
||
datePicker1.datepicker({ | ||
autoclose: true, | ||
orientation: "top auto", | ||
todayBtn: "linked", | ||
todayHighlight: true | ||
}); | ||
|
||
datePicker1.datepicker('show'); | ||
|
||
setTimeout(function () { | ||
expect($('.datepicker-dropdown')).toExist(); | ||
|
||
//close datepicker1 | ||
datePicker1.datepicker('hide'); | ||
expect($('.datepicker-dropdown')).not.toExist(); | ||
|
||
done(); | ||
}, globals.wait); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
describe("bootstrap-select test suite", function () { | ||
|
||
beforeEach(function () { | ||
globals.readFixture(globals.fixturePath + 'bootstrap-select.html'); | ||
}); | ||
|
||
it('should use the plugin to take the first select and add a dropdown menu list with 11 items', function (done) { | ||
var select = $('.selectpicker:first'); | ||
|
||
//render the select using the plugin | ||
select.selectpicker(); | ||
|
||
setTimeout(function () { | ||
var renderedMenuList = select.siblings().find('.dropdown-menu li'); | ||
expect(renderedMenuList).toHaveLength(11); | ||
done(); | ||
}, globals.wait); | ||
}); | ||
|
||
}); |
Oops, something went wrong.