@@ -504,7 +504,7 @@ describe('tooltip', function() {
504
504
505
505
it ( 'should use it to show but set the hide trigger based on the map for mapped triggers' , inject ( function ( $compile ) {
506
506
elmBody = angular . element (
507
- '<div><input uib-tooltip="Hello!" tooltip-trigger="focus" /></div>'
507
+ '<div><input uib-tooltip="Hello!" tooltip-trigger="\' focus\' " /></div>'
508
508
) ;
509
509
$compile ( elmBody ) ( scope ) ;
510
510
scope . $apply ( ) ;
@@ -521,7 +521,7 @@ describe('tooltip', function() {
521
521
522
522
it ( 'should use it as both the show and hide triggers for unmapped triggers' , inject ( function ( $compile ) {
523
523
elmBody = angular . element (
524
- '<div><input uib-tooltip="Hello!" tooltip-trigger="fakeTriggerAttr" /></div>'
524
+ '<div><input uib-tooltip="Hello!" tooltip-trigger="\' fakeTriggerAttr\' " /></div>'
525
525
) ;
526
526
$compile ( elmBody ) ( scope ) ;
527
527
scope . $apply ( ) ;
@@ -540,8 +540,8 @@ describe('tooltip', function() {
540
540
scope . test = true ;
541
541
elmBody = angular . element (
542
542
'<div>' +
543
- '<input uib-tooltip="Hello!" tooltip-trigger="{{ ( test && \'mouseenter\' || \'click\') }} " />' +
544
- '<input uib-tooltip="Hello!" tooltip-trigger="{{ ( test && \'mouseenter\' || \'click\') }} " />' +
543
+ '<input uib-tooltip="Hello!" tooltip-trigger="test && \'mouseenter\' || \'click\'" />' +
544
+ '<input uib-tooltip="Hello!" tooltip-trigger="test && \'mouseenter\' || \'click\'" />' +
545
545
'</div>'
546
546
) ;
547
547
@@ -566,7 +566,7 @@ describe('tooltip', function() {
566
566
567
567
it ( 'should accept multiple triggers based on the map for mapped triggers' , inject ( function ( $compile ) {
568
568
elmBody = angular . element (
569
- '<div><input uib-tooltip="Hello!" tooltip-trigger="focus fakeTriggerAttr" /></div>'
569
+ '<div><input uib-tooltip="Hello!" tooltip-trigger="\' focus fakeTriggerAttr\' " /></div>'
570
570
) ;
571
571
$compile ( elmBody ) ( scope ) ;
572
572
scope . $apply ( ) ;
@@ -587,7 +587,7 @@ describe('tooltip', function() {
587
587
588
588
it ( 'should not show when trigger is set to "none"' , inject ( function ( $compile ) {
589
589
elmBody = angular . element (
590
- '<div><input uib-tooltip="Hello!" tooltip-trigger="none" /></div>'
590
+ '<div><input uib-tooltip="Hello!" tooltip-trigger="\' none\' " /></div>'
591
591
) ;
592
592
$compile ( elmBody ) ( scope ) ;
593
593
scope . $apply ( ) ;
@@ -601,7 +601,7 @@ describe('tooltip', function() {
601
601
602
602
it ( 'should toggle on click and hide when anything else is clicked when trigger is set to "outsideClick"' , inject ( function ( $compile , $document ) {
603
603
elm = $compile ( angular . element (
604
- '<span uib-tooltip="tooltip text" tooltip-trigger="outsideClick">Selector Text</span>'
604
+ '<span uib-tooltip="tooltip text" tooltip-trigger="\' outsideClick\' ">Selector Text</span>'
605
605
) ) ( scope ) ;
606
606
scope . $apply ( ) ;
607
607
elmScope = elm . scope ( ) ;
@@ -623,6 +623,23 @@ describe('tooltip', function() {
623
623
tooltipScope . $digest ( ) ;
624
624
expect ( tooltipScope . isOpen ) . toBeFalsy ( ) ;
625
625
} ) ) ;
626
+
627
+ it ( 'should support objects' , inject ( function ( $compile ) {
628
+ elmBody = angular . element (
629
+ '<div><input uib-tooltip="Hello!" tooltip-trigger="{show: \'hide\'}" /></div>'
630
+ ) ;
631
+ $compile ( elmBody ) ( scope ) ;
632
+ scope . $apply ( ) ;
633
+ elm = elmBody . find ( 'input' ) ;
634
+ elmScope = elm . scope ( ) ;
635
+ tooltipScope = elmScope . $$childTail ;
636
+
637
+ expect ( tooltipScope . isOpen ) . toBeFalsy ( ) ;
638
+ trigger ( elm , 'show' ) ;
639
+ expect ( tooltipScope . isOpen ) . toBeTruthy ( ) ;
640
+ trigger ( elm , 'hide' ) ;
641
+ expect ( tooltipScope . isOpen ) . toBeFalsy ( ) ;
642
+ } ) ) ;
626
643
} ) ;
627
644
628
645
describe ( 'with an append-to-body attribute' , function ( ) {
@@ -673,7 +690,7 @@ describe('tooltip', function() {
673
690
}
674
691
675
692
beforeEach ( inject ( function ( $compile , $rootScope ) {
676
- elmBody = angular . element ( '<div><input uib-tooltip="Hello!" tooltip-trigger="fooTrigger" /></div>' ) ;
693
+ elmBody = angular . element ( '<div><input uib-tooltip="Hello!" tooltip-trigger="\' fooTrigger\' " /></div>' ) ;
677
694
678
695
$compile ( elmBody ) ( $rootScope ) ;
679
696
$rootScope . $apply ( ) ;
@@ -754,7 +771,7 @@ describe('tooltipWithDifferentSymbols', function() {
754
771
755
772
it ( 'should show the correct tooltip text' , inject ( function ( $compile , $rootScope ) {
756
773
elmBody = angular . element (
757
- '<div><input type="text" uib-tooltip="My tooltip" tooltip-trigger="focus" tooltip-placement="right" /></div>'
774
+ '<div><input type="text" uib-tooltip="My tooltip" tooltip-trigger="\' focus\' " tooltip-placement="right" /></div>'
758
775
) ;
759
776
$compile ( elmBody ) ( $rootScope ) ;
760
777
$rootScope . $apply ( ) ;
@@ -1030,7 +1047,7 @@ describe('$uibTooltipProvider', function() {
1030
1047
1031
1048
it ( 'should override the show and hide triggers if there is an attribute' , inject ( function ( $rootScope , $compile ) {
1032
1049
elmBody = angular . element (
1033
- '<div><input uib-tooltip="tooltip text" tooltip-trigger="mouseenter"/></div>'
1050
+ '<div><input uib-tooltip="tooltip text" tooltip-trigger="\' mouseenter\' "/></div>'
1034
1051
) ;
1035
1052
1036
1053
scope = $rootScope ;
0 commit comments