@@ -96,6 +96,18 @@ describe('tooltip', function() {
96
96
'options-placement-exotic-bottom-right' : {
97
97
element : '<a data-placement="bottom-right" bs-tooltip="tooltip" data-viewport="null">hover me</a>'
98
98
} ,
99
+ 'options-placement-exotic-right-top' : {
100
+ element : '<a data-placement="right-top" bs-tooltip="tooltip" data-viewport="null">hover me</a>'
101
+ } ,
102
+ 'options-placement-exotic-right-bottom' : {
103
+ element : '<a data-placement="right-bottom" bs-tooltip="tooltip" data-viewport="null">hover me</a>'
104
+ } ,
105
+ 'options-placement-exotic-left-top' : {
106
+ element : '<a data-placement="left-top" bs-tooltip="tooltip" data-viewport="null">hover me</a>'
107
+ } ,
108
+ 'options-placement-exotic-left-bottom' : {
109
+ element : '<a data-placement="left-bottom" bs-tooltip="tooltip" data-viewport="null">hover me</a>'
110
+ } ,
99
111
'options-placement-auto' : {
100
112
element : '<a data-placement="auto" bs-tooltip="tooltip" data-viewport="null">hover me</a>'
101
113
} ,
@@ -768,7 +780,7 @@ describe('tooltip', function() {
768
780
769
781
$$rAF . flush ( ) ;
770
782
expect ( sandboxEl . children ( '.tooltip' ) . hasClass ( 'top' ) ) . toBeTruthy ( ) ;
771
- } )
783
+ } ) ;
772
784
773
785
it ( 'should remove `auto` from exotic placements when auto positioning' , function ( ) {
774
786
var elm = compileDirective ( 'options-placement-auto-exotic-top-left' ) ;
@@ -780,7 +792,7 @@ describe('tooltip', function() {
780
792
781
793
$$rAF . flush ( ) ;
782
794
expect ( sandboxEl . children ( '.tooltip' ) . hasClass ( 'bottom-right' ) ) . toBeTruthy ( ) ;
783
- } )
795
+ } ) ;
784
796
785
797
it ( 'should default to `top` when `auto` placement is set without a preference' , function ( ) {
786
798
var elm = compileDirective ( 'options-placement-auto' ) ;
@@ -978,7 +990,7 @@ describe('tooltip', function() {
978
990
placements [ placement ] = {
979
991
top : tipElement . style . top ,
980
992
left : tipElement . style . left ,
981
- }
993
+ } ;
982
994
983
995
// Clear the sandbox after we've rendered
984
996
// each tooltip
@@ -989,7 +1001,7 @@ describe('tooltip', function() {
989
1001
}
990
1002
991
1003
return placements ;
992
- } ;
1004
+ }
993
1005
994
1006
var standardPlacements ,
995
1007
autoPlacements ,
@@ -1012,6 +1024,10 @@ describe('tooltip', function() {
1012
1024
'options-placement-exotic-top-right' : { } ,
1013
1025
'options-placement-exotic-bottom-left' : { } ,
1014
1026
'options-placement-exotic-bottom-right' : { } ,
1027
+ 'options-placement-exotic-right-top' : { } ,
1028
+ 'options-placement-exotic-right-bottom' : { } ,
1029
+ 'options-placement-exotic-left-top' : { } ,
1030
+ 'options-placement-exotic-left-bottom' : { }
1015
1031
} , styleEl ) ;
1016
1032
1017
1033
autoPlacements = calculatePlacements ( {
@@ -1022,7 +1038,7 @@ describe('tooltip', function() {
1022
1038
'options-placement-auto-exotic-top-left' : { } ,
1023
1039
'options-placement-auto-exotic-top-right' : { } ,
1024
1040
'options-placement-auto-exotic-bottom-left' : { } ,
1025
- 'options-placement-auto-exotic-bottom-right' : { } ,
1041
+ 'options-placement-auto-exotic-bottom-right' : { }
1026
1042
} , styleEl ) ;
1027
1043
1028
1044
// Change the style for viewport testing
@@ -1043,7 +1059,7 @@ describe('tooltip', function() {
1043
1059
'options-placement-viewport-bottom' : { } ,
1044
1060
'options-placement-viewport-left' : { } ,
1045
1061
'options-placement-viewport-padding' : { } ,
1046
- 'options-placement-viewport-exotic' : { } ,
1062
+ 'options-placement-viewport-exotic' : { }
1047
1063
} , styleEl ) ;
1048
1064
} ) ;
1049
1065
@@ -1130,6 +1146,34 @@ describe('tooltip', function() {
1130
1146
expect ( placement . top ) . toBe ( '20px' ) ;
1131
1147
expect ( placement . left ) . toBe ( '-180px' ) ;
1132
1148
} ) ;
1149
+
1150
+ it ( 'should position the tooltip to the left-top of the target when placement is `left-top`' , function ( ) {
1151
+ var placement = standardPlacements [ 'options-placement-exotic-left-top' ] ;
1152
+
1153
+ expect ( placement . top ) . toBe ( '-80px' ) ;
1154
+ expect ( placement . left ) . toBe ( '-200px' ) ;
1155
+ } ) ;
1156
+
1157
+ it ( 'should position the tooltip to the left-bottom of the target when placement is `left-bottom`' , function ( ) {
1158
+ var placement = standardPlacements [ 'options-placement-exotic-left-bottom' ] ;
1159
+
1160
+ expect ( placement . top ) . toBe ( '0px' ) ;
1161
+ expect ( placement . left ) . toBe ( '-200px' ) ;
1162
+ } ) ;
1163
+
1164
+ it ( 'should position the tooltip to the right-top of the target when placement is `right-top`' , function ( ) {
1165
+ var placement = standardPlacements [ 'options-placement-exotic-right-top' ] ;
1166
+
1167
+ expect ( placement . top ) . toBe ( '-80px' ) ;
1168
+ expect ( placement . left ) . toBe ( '20px' ) ;
1169
+ } ) ;
1170
+
1171
+ it ( 'should position the tooltip to the right-bottom of the target when placement is `right-bottom`' , function ( ) {
1172
+ var placement = standardPlacements [ 'options-placement-exotic-right-bottom' ] ;
1173
+
1174
+ expect ( placement . top ) . toBe ( '0px' ) ;
1175
+ expect ( placement . left ) . toBe ( '20px' ) ;
1176
+ } ) ;
1133
1177
} ) ;
1134
1178
1135
1179
describe ( 'auto placements' , function ( ) {
@@ -1138,7 +1182,7 @@ describe('tooltip', function() {
1138
1182
var bottom = standardPlacements [ 'options-placement-bottom' ] ;
1139
1183
1140
1184
// top is offscreen, so it should swap to bottom and match the standard bottom
1141
- expect ( autoTop . top ) . toBe ( bottom . top )
1185
+ expect ( autoTop . top ) . toBe ( bottom . top ) ;
1142
1186
expect ( autoTop . left ) . toBe ( bottom . left )
1143
1187
} ) ;
1144
1188
@@ -1147,7 +1191,7 @@ describe('tooltip', function() {
1147
1191
var left = standardPlacements [ 'options-placement-left' ] ;
1148
1192
1149
1193
// right is offscreen, so it should swap to left and match the standard left
1150
- expect ( autoRight . top ) . toBe ( left . top )
1194
+ expect ( autoRight . top ) . toBe ( left . top ) ;
1151
1195
expect ( autoRight . left ) . toBe ( left . left )
1152
1196
} ) ;
1153
1197
@@ -1156,7 +1200,7 @@ describe('tooltip', function() {
1156
1200
var top = standardPlacements [ 'options-placement-top' ] ;
1157
1201
1158
1202
// bottom is offscreen, so it should swap to top and match the standard top
1159
- expect ( autoBottom . top ) . toBe ( top . top )
1203
+ expect ( autoBottom . top ) . toBe ( top . top ) ;
1160
1204
expect ( autoBottom . left ) . toBe ( top . left )
1161
1205
} ) ;
1162
1206
@@ -1165,7 +1209,7 @@ describe('tooltip', function() {
1165
1209
var right = standardPlacements [ 'options-placement-right' ] ;
1166
1210
1167
1211
// left is offscreen, so it should swap to right and match the standard right
1168
- expect ( autoLeft . top ) . toBe ( right . top )
1212
+ expect ( autoLeft . top ) . toBe ( right . top ) ;
1169
1213
expect ( autoLeft . left ) . toBe ( right . left )
1170
1214
} ) ;
1171
1215
@@ -1174,7 +1218,7 @@ describe('tooltip', function() {
1174
1218
var bottomLeft = standardPlacements [ 'options-placement-exotic-bottom-left' ] ;
1175
1219
1176
1220
// should swap to bottom-left and match the standard bottom-left
1177
- expect ( autoTopRight . top ) . toBe ( bottomLeft . top )
1221
+ expect ( autoTopRight . top ) . toBe ( bottomLeft . top ) ;
1178
1222
expect ( autoTopRight . left ) . toBe ( bottomLeft . left )
1179
1223
} ) ;
1180
1224
@@ -1183,7 +1227,7 @@ describe('tooltip', function() {
1183
1227
var bottomRight = standardPlacements [ 'options-placement-exotic-bottom-right' ] ;
1184
1228
1185
1229
// should swap to bottom-right and match the standard bottom-right
1186
- expect ( autoTopLeft . top ) . toBe ( bottomRight . top )
1230
+ expect ( autoTopLeft . top ) . toBe ( bottomRight . top ) ;
1187
1231
expect ( autoTopLeft . left ) . toBe ( bottomRight . left )
1188
1232
} ) ;
1189
1233
@@ -1192,7 +1236,7 @@ describe('tooltip', function() {
1192
1236
var topLeft = standardPlacements [ 'options-placement-exotic-top-left' ] ;
1193
1237
1194
1238
// should swap to top-left and match the standard top-left
1195
- expect ( autoBottomRight . top ) . toBe ( topLeft . top )
1239
+ expect ( autoBottomRight . top ) . toBe ( topLeft . top ) ;
1196
1240
expect ( autoBottomRight . left ) . toBe ( topLeft . left )
1197
1241
} ) ;
1198
1242
@@ -1201,7 +1245,7 @@ describe('tooltip', function() {
1201
1245
var topRight = standardPlacements [ 'options-placement-exotic-top-right' ] ;
1202
1246
1203
1247
// should swap to top-right and match the standard top-right
1204
- expect ( autoBottomLeft . top ) . toBe ( topRight . top )
1248
+ expect ( autoBottomLeft . top ) . toBe ( topRight . top ) ;
1205
1249
expect ( autoBottomLeft . left ) . toBe ( topRight . left )
1206
1250
} ) ;
1207
1251
} ) ;
0 commit comments