-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed bsdate warnings with latest ui-bootstrap #456
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
app.controller('DevBsdateCtrl', function($scope) { | ||
$scope.user = { | ||
dob: new Date(1984, 4, 15), | ||
startDate: '', | ||
hireDate: new Date(2006, 4, 15) | ||
}; | ||
|
||
$scope.getMinDate = function() { | ||
return new Date(1984, 4, 01); | ||
}; | ||
|
||
$scope.getMaxDate = function($event, elementOpened) { | ||
return new Date(2016, 4, 01); | ||
}; | ||
|
||
$scope.getInitDate = function($event, elementOpened) { | ||
return new Date(); | ||
}; | ||
|
||
$scope.opened = {}; | ||
|
||
$scope.open = function($event, elementOpened) { | ||
$event.preventDefault(); | ||
$event.stopPropagation(); | ||
|
||
$scope.opened[elementOpened] = !$scope.opened[elementOpened]; | ||
}; | ||
}); |
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 @@ | ||
dev | ||
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,116 @@ | ||
describe('bsdate', function() { | ||
|
||
beforeEach(function() { | ||
browser().navigateTo(mainUrl); | ||
}); | ||
|
||
it('should show editor and submit new value', function() { | ||
var s = '[ng-controller="DevBsdateCtrl"] '; | ||
|
||
expect(element(s+'a#minMax').css('display')).not().toBe('none'); | ||
expect(element(s+'a#minMax').text()).toMatch('15/05/1984'); | ||
element(s+'a#minMax').click(); | ||
element(s+'form .input-group-btn button[type="button"]').click(); | ||
|
||
expect(element(s+'a#minMax').css('display')).toBe('none'); | ||
expect(element(s+'form[editable-form="$form"]').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]:visible').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]').val()).toBe('15-May-1984'); | ||
expect(element(s+'form .editable-buttons button[type="submit"]:visible').count()).toBe(1); | ||
expect(element(s+'form .editable-buttons button[type="button"]:visible').count()).toBe(1); | ||
expect(element(s+'ul.dropdown-menu:visible').count()).toBe(1); | ||
expect(element(s+'form table button.btn-info span').text()).toMatch('15'); | ||
|
||
//set 01 May | ||
element(s+'form table > tbody > tr:eq(0) > td:eq(3) > button').click(); | ||
expect(element(s+'ul.dropdown-menu:visible').count()).toBe(0); | ||
expect(element(s+'form input[type="text"]').val()).toBe('01-May-1984'); | ||
|
||
//submit | ||
element(s+'form button[type="submit"]').click(); | ||
|
||
expect(element(s+'a#minMax').css('display')).not().toBe('none'); | ||
expect(element(s+'a#minMax').text()).toMatch('01/05/1984'); | ||
expect(element(s+'form').count()).toBe(0); | ||
}); | ||
|
||
it('should show editor and not submit new value when new value is outside of date range', function() { | ||
var s = '[ng-controller="DevBsdateCtrl"] '; | ||
|
||
expect(element(s+'a#minMax').css('display')).not().toBe('none'); | ||
expect(element(s+'a#minMax').text()).toMatch('15/05/1984'); | ||
element(s+'a#minMax').click(); | ||
element(s+'form .input-group-btn button[type="button"]').click(); | ||
|
||
expect(element(s+'a#minMax').css('display')).toBe('none'); | ||
expect(element(s+'form[editable-form="$form"]').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]:visible').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]').val()).toBe('15-May-1984'); | ||
expect(element(s+'form .editable-buttons button[type="submit"]:visible').count()).toBe(1); | ||
expect(element(s+'form .editable-buttons button[type="button"]:visible').count()).toBe(1); | ||
expect(element(s+'ul.dropdown-menu:visible').count()).toBe(1); | ||
expect(element(s+'form table button.btn-info span').text()).toMatch('15'); | ||
|
||
//set 29 april | ||
element(s+'form table > tbody > tr:eq(0) > td:eq(1) > button').click(); | ||
expect(element(s+'form table > tbody > tr:eq(0) > td:eq(1) > button').attr('disabled')).toBe("disabled"); | ||
expect(element(s+'ul.dropdown-menu:visible').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]').val()).toBe('15-May-1984'); | ||
|
||
//submit | ||
element(s+'form button[type="submit"]').click(); | ||
|
||
expect(element(s+'a#minMax').css('display')).not().toBe('none'); | ||
expect(element(s+'a#minMax').text()).toMatch(''); | ||
expect(element(s+'form').count()).toBe(0); | ||
}); | ||
|
||
it('should show editor with selected date set to the current date', function() { | ||
var s = '[ng-controller="DevBsdateCtrl"] '; | ||
|
||
expect(element(s+'a#initDate').css('display')).not().toBe('none'); | ||
expect(element(s+'a#initDate').text()).toMatch('empty'); | ||
element(s+'a#initDate').click(); | ||
element(s+'form .input-group-btn button[type="button"]').click(); | ||
|
||
expect(element(s+'a#initDate').css('display')).toBe('none'); | ||
expect(element(s+'form[editable-form="$form"]').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]:visible').count()).toBe(1); | ||
expect(element(s+'form .editable-buttons button[type="submit"]:visible').count()).toBe(1); | ||
expect(element(s+'form .editable-buttons button[type="button"]:visible').count()).toBe(1); | ||
expect(element(s+'ul.dropdown-menu:visible').count()).toBe(1); | ||
expect(element(s+'form table button.btn-sm span').text()).toMatch(new Date().getDate()); | ||
}); | ||
|
||
|
||
it('should show editor and submit new value and input field is read only', function() { | ||
var s = '[ng-controller="DevBsdateCtrl"] '; | ||
|
||
expect(element(s+'a#readOnly').css('display')).not().toBe('none'); | ||
expect(element(s+'a#readOnly').text()).toMatch('15/05/2006'); | ||
element(s+'a#readOnly').click(); | ||
element(s+'form .input-group-btn button[type="button"]').click(); | ||
|
||
expect(element(s+'a#readOnly').css('display')).toBe('none'); | ||
expect(element(s+'form[editable-form="$form"]').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]:visible').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]').attr('readonly')).toBe("readonly"); | ||
expect(element(s+'form input[type="text"]').val()).toBe('15-May-2006'); | ||
expect(element(s+'form .editable-buttons button[type="submit"]:visible').count()).toBe(1); | ||
expect(element(s+'form .editable-buttons button[type="button"]:visible').count()).toBe(1); | ||
expect(element(s+'ul.dropdown-menu:visible').count()).toBe(1); | ||
expect(element(s+'form table button.btn-info span').text()).toMatch('15'); | ||
|
||
//set 01 May | ||
element(s+'form table > tbody > tr:eq(0) > td:eq(3) > button').click(); | ||
expect(element(s+'ul.dropdown-menu:visible').count()).toBe(0); | ||
expect(element(s+'form input[type="text"]').val()).toBe('02-May-2006'); | ||
|
||
//submit | ||
element(s+'form button[type="submit"]').click(); | ||
|
||
expect(element(s+'a#readOnly').css('display')).not().toBe('none'); | ||
expect(element(s+'a#readOnly').text()).toMatch('02/05/2006'); | ||
expect(element(s+'form').count()).toBe(0); | ||
}); | ||
}); |
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,35 @@ | ||
<div ng-controller="DevBsdateCtrl"> | ||
<a href="#" editable-bsdate="user.dob" | ||
e-is-open="opened.$data" | ||
e-ng-click="open($event,'$data')" | ||
e-datepicker-popup="dd-MMMM-yyyy" | ||
e-min-date="getMinDate()" | ||
e-max-date="getMaxDate()" | ||
e-on-open-focus="true" | ||
id="minMax" | ||
class="minMax"> | ||
{{ (user.dob | date:"dd/MM/yyyy") || 'empty' }} | ||
</a> | ||
|
||
<a href="#" editable-bsdate="user.startDate" | ||
e-is-open="opened.$data" | ||
e-ng-click="open($event,'$data')" | ||
e-datepicker-popup="dd-MMMM-yyyy" | ||
e-init-date="getInitDate()" | ||
id="initDate" | ||
class="initDate"> | ||
{{ (user.startDate | date:"dd/MM/yyyy") || 'empty' }} | ||
</a> | ||
|
||
<a href="#" editable-bsdate="user.hireDate" | ||
e-is-open="opened.$data" | ||
e-ng-click="open($event,'$data')" | ||
e-datepicker-popup="dd-MMMM-yyyy" | ||
e-init-date="getInitDate()" | ||
e-on-open-focus="true" | ||
e-readonly="true" | ||
id="readOnly" | ||
class="readOnly"> | ||
{{ (user.hireDate | date:"dd/MM/yyyy") || 'empty' }} | ||
</a> | ||
</div> |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this file is empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did what all the other "dev-" files did, which is just put "dev" in it. This is a dev only test and only shows up on the dev.html file.