Skip to content

Commit

Permalink
fix(ionItem): transform to <a> tag for ui-sref
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed May 12, 2014
1 parent 58c97e0 commit c6c1300
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion js/angular/directive/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ function($animate, $compile) {
}],
scope: true,
compile: function($element, $attrs) {
var isAnchor = angular.isDefined($attrs.href) || angular.isDefined($attrs.ngHref);
var isAnchor = angular.isDefined($attrs.href) ||
angular.isDefined($attrs.ngHref) ||
angular.isDefined($attrs.uiSref);
var isComplexItem = isAnchor ||
//Lame way of testing, but we have to know at compile what to do with the element
/ion-(delete|option|reorder)-button/i.test($element.html());
Expand Down
6 changes: 6 additions & 0 deletions test/unit/angular/directive/list.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ describe('ionItem directive', function() {
expect(el.hasClass('item')).toBe(true);
expect(el.hasClass('item-complex')).toBe(false);
});
it('should be complex if ui-sref', function() {
var el = setup('ui-sref="something"');
expect(el.hasClass('item item-complex')).toBe(true);
expect(el.children()[0].tagName).toBe('A');
expect(el.children().hasClass('item-content')).toBe(true);
});
['href', 'ng-href'].forEach(function(attr) {
it('should be complex anchor if '+attr+' is defined', function() {
var el = setup(attr+'="something/{{foo}}"');
Expand Down

0 comments on commit c6c1300

Please sign in to comment.