Skip to content

Commit

Permalink
Updates tests
Browse files Browse the repository at this point in the history
- Adds default value for scrollable option
- Updates tests
  • Loading branch information
tiesont committed Apr 4, 2019
1 parent 8896d80 commit f89a0ce
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 9 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## 5.0.1 (Latest Release)
## 5.1.0 (Latest Release)

- Adds `scrollable` option, which enables the scrollable modal content added in Bootstrap 4.3
- Adds `extra-large` as a size option
- Adds aliased/alternative keys for all size options: `sm`, `lg`, `xl`

### 5.0.1

- Adds Tamil locale

Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,22 @@ Bootbox **3.3.0** is the *last* release to support Bootstrap 2.2.x.

Much more dependency information can be found [on the Bootbox website](http://bootboxjs.com/getting-started.html#bootbox-dependencies).

### Latest Release: 5.0.0
### 5.1.0 (Latest Release)

- Adds `scrollable` option, which enables the scrollable modal content added in Bootstrap 4.3
- Adds `extra-large` as a size option
- Adds aliased/alternative keys for all size options: `sm`, `lg`, `xl`

#### 5.0.1

- Adds Tamil locale

#### 5.0.0

- Updates Bootbox to be compatible with both Bootstrap 4 and Bootstrap 3.
- Pulls button locale options to separate file
- Corrects Russion locale
- Changes default button trigger to target the button with the `bootbox-accept` class; this corrects instances where no button has the `btn-primary` class.
- Various bugfixes

#### Prompt
Expand Down
4 changes: 2 additions & 2 deletions dist/bootbox.all.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bootbox.locales.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/bootbox.min.js

Large diffs are not rendered by default.

Binary file removed dist/bootbox.zip
Binary file not shown.
Binary file added dist/bootstrap.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion header.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* bootbox.js 5.0.1
* bootbox.js 5.1.0
*
* http://bootboxjs.com/license.txt
*/
4 changes: 3 additions & 1 deletion src/bootbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@
// center modal vertically in page
centerVertical: false,
// Append "multiple" property to the select when using the "prompt" helper
multiple: false
multiple: false,
// Automatically scroll modal content when height exceeds viewport height
scrollable: false
};


Expand Down
80 changes: 80 additions & 0 deletions tests/defaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,37 @@ describe('bootbox.setDefaults', function() {
});

describe('size', function() {
describe('when set to extra-large', function() {
beforeEach(function() {
bootbox.setDefaults({
size: 'extra-large'
});

this.dialog = bootbox.dialog({
message: 'test'
});
});

it('adds the extra-large class to the innerDialog', function() {
expect(this.dialog.children('.modal-dialog').hasClass('modal-xl')).to.be.true;
});
});
describe('when set to xl', function() {
beforeEach(function() {
bootbox.setDefaults({
size: 'xl'
});

this.dialog = bootbox.dialog({
message: 'test'
});
});

it('adds the extra-large class to the innerDialog', function() {
expect(this.dialog.children('.modal-dialog').hasClass('modal-xl')).to.be.true;
});
});

describe('when set to large', function() {
beforeEach(function() {
bootbox.setDefaults({
Expand All @@ -87,6 +118,22 @@ describe('bootbox.setDefaults', function() {
expect(this.dialog.children('.modal-dialog').hasClass('modal-lg')).to.be.true;
});
});
describe('when set to lg', function() {
beforeEach(function() {
bootbox.setDefaults({
size: 'lg'
});

this.dialog = bootbox.dialog({
message: 'test'
});
});

it('adds the large class to the innerDialog', function() {
expect(this.dialog.children('.modal-dialog').hasClass('modal-lg')).to.be.true;
});
});

describe('when set to small', function() {
beforeEach(function() {
bootbox.setDefaults({
Expand All @@ -98,6 +145,21 @@ describe('bootbox.setDefaults', function() {
});
});

it('adds the small class to the innerDialog', function() {
expect(this.dialog.children('.modal-dialog').hasClass('modal-sm')).to.be.true;
});
});
describe('when set to sm', function() {
beforeEach(function() {
bootbox.setDefaults({
size: 'sm'
});

this.dialog = bootbox.dialog({
message: 'test'
});
});

it('adds the small class to the innerDialog', function() {
expect(this.dialog.children('.modal-dialog').hasClass('modal-sm')).to.be.true;
});
Expand Down Expand Up @@ -139,6 +201,24 @@ describe('bootbox.setDefaults', function() {
});
});
});

describe('scrollable', function() {
describe('when set to true', function() {
beforeEach(function() {
bootbox.setDefaults({
scrollable: true
});

this.dialog = bootbox.dialog({
message: 'test'
});
});

it('adds the modal-dialog-scrollable class to the innerDialog', function() {
expect(this.dialog.children('.modal-dialog').hasClass('modal-dialog-scrollable')).to.be.true;
});
});
});

describe('when passed two arguments', function() {
beforeEach(function() {
Expand Down

0 comments on commit f89a0ce

Please sign in to comment.