-
-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #491 from HS2-SOLUTIONS/master
Added popover functionality
- Loading branch information
Showing
16 changed files
with
296 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
app.controller('DevUiSelectCtrl', function($scope) { | ||
$scope.user = { | ||
state: 'Arizona', | ||
state2: 'Kansas' | ||
state2: 'Kansas', | ||
tag: [] | ||
}; | ||
|
||
$scope.states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Dakota', 'North Carolina', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']; | ||
|
||
$scope.tags = ['JavaScript', 'Angular', 'TypeScript']; | ||
}); |
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,5 @@ | ||
app.controller('EditPopoverCtrl', function($scope) { | ||
$scope.user = { | ||
name: 'awesome user' | ||
}; | ||
}); |
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 @@ | ||
To made an editable field display in a popover, wrap the editable in `<div class="item-wrapper">`. |
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,86 @@ | ||
describe('editable-popover', function() { | ||
|
||
beforeEach(function() { | ||
browser().navigateTo(mainUrl); | ||
}); | ||
|
||
|
||
it('should show editor and submit new value', function() { | ||
var s = '[ng-controller="EditPopoverCtrl"] '; | ||
|
||
expect(element(s+'a').css('display')).not().toBe('none'); | ||
expect(element(s+'a').text()).toMatch('awesome user'); | ||
element(s+'a').click(); | ||
|
||
expect(element(s+'a').css('display')).toBe('inline'); | ||
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('awesome user'); | ||
expect(element(s+'form button[type="submit"]:visible').count()).toBe(1); | ||
expect(element(s+'form button[type="button"]:visible').count()).toBe(1); | ||
|
||
using(s).input('$data').enter('username2'); | ||
element(s+'form button[type="submit"]').click(); | ||
|
||
expect(element(s+'a').css('display')).not().toBe('none'); | ||
expect(element(s+'a').text()).toBe('username2'); | ||
expect(element(s+'form').count()).toBe(0); | ||
}); | ||
|
||
it('should not save by cancel button', function() { | ||
var s = '[ng-controller="EditPopoverCtrl"] '; | ||
element(s+'a').click(); | ||
|
||
using(s).input('$data').enter('username2'); | ||
element(s+'form button[type="button"]').click(); | ||
|
||
expect(element(s+'a').css('display')).not().toBe('none'); | ||
expect(element(s+'a').text()).toMatch('awesome user'); | ||
expect(element(s+'form').count()).toBe(0); | ||
}); | ||
|
||
it('should attach `editable-empty` class', function() { | ||
var s = '[ng-controller="EditPopoverCtrl"] '; | ||
|
||
expect(element(s+'a').css('display')).not().toBe('none'); | ||
expect(element(s+'a').text()).toMatch('awesome user'); | ||
expect(element(s+'a').attr('class')).not().toMatch('editable-empty'); | ||
element(s+'a').click(); | ||
|
||
expect(element(s+'a').css('display')).toBe('inline'); | ||
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('awesome user'); | ||
expect(element(s+'form button[type="submit"]:visible').count()).toBe(1); | ||
expect(element(s+'form button[type="button"]:visible').count()).toBe(1); | ||
|
||
using(s).input('$data').enter(''); | ||
element(s+'form button[type="submit"]').click(); | ||
|
||
expect(element(s+'a').css('display')).not().toBe('none'); | ||
expect(element(s+'a').text()).toBe('empty'); | ||
expect(element(s+'a').attr('class')).toMatch('editable-empty'); | ||
expect(element(s+'form').count()).toBe(0); | ||
}); | ||
|
||
it('should cancel by click on body', function() { | ||
var s = '[ng-controller="EditPopoverCtrl"] '; | ||
element(s+'a').click(); | ||
|
||
expect(element(s+'a').css('display')).toBe('inline'); | ||
expect(element(s+'form[editable-form="$form"]').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]:visible').count()).toBe(1); | ||
|
||
// click on input - still visible | ||
element(s+'form input[type="text"]').click(); | ||
expect(element(s+'a').css('display')).toBe('inline'); | ||
expect(element(s+'form[editable-form="$form"]').count()).toBe(1); | ||
expect(element(s+'form input[type="text"]:visible').count()).toBe(1); | ||
|
||
// click on body - close | ||
element('body').click(); | ||
expect(element(s+'a').css('display')).not().toBe('none'); | ||
expect(element(s+'a').text()).toMatch('awesome user'); | ||
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,5 @@ | ||
<div ng-controller="EditPopoverCtrl"> | ||
<div class="popover-wrapper"> | ||
<a href="#" editable-text="user.name">{{user.name || 'empty' }}</a> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<div ng-controller="RadiolistCtrl"> | ||
<a href="#" editable-radiolist="user.status" e-ng-options="s.value as s.text for s in statuses"> | ||
<a href="#" editable-radiolist="user.status" e-ng-options="s.value as s.text for s in ::statuses track by s.value"> | ||
{{ showStatus() }} | ||
</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
Oops, something went wrong.