(elementAttach, targetAttach)
| 294 | } |
| 295 | |
| 296 | updateAttachClasses(elementAttach, targetAttach) { |
| 297 | elementAttach = elementAttach || this.attachment; |
| 298 | targetAttach = targetAttach || this.targetAttachment; |
| 299 | const sides = ['left', 'top', 'bottom', 'right', 'middle', 'center']; |
| 300 | const { classes, classPrefix } = this.options; |
| 301 | |
| 302 | if (!isUndefined(this._addAttachClasses) && this._addAttachClasses.length) { |
| 303 | // updateAttachClasses can be called more than once in a position call, so |
| 304 | // we need to clean up after ourselves such that when the last defer gets |
| 305 | // ran it doesn't add any extra classes from previous calls. |
| 306 | this._addAttachClasses.splice(0, this._addAttachClasses.length); |
| 307 | } |
| 308 | |
| 309 | if (isUndefined(this._addAttachClasses)) { |
| 310 | this._addAttachClasses = []; |
| 311 | } |
| 312 | this.add = this._addAttachClasses; |
| 313 | |
| 314 | if (elementAttach.top) { |
| 315 | this.add.push( |
| 316 | `${getClass('element-attached', classes, classPrefix)}-${ |
| 317 | elementAttach.top |
| 318 | }` |
| 319 | ); |
| 320 | } |
| 321 | if (elementAttach.left) { |
| 322 | this.add.push( |
| 323 | `${getClass('element-attached', classes, classPrefix)}-${ |
| 324 | elementAttach.left |
| 325 | }` |
| 326 | ); |
| 327 | } |
| 328 | if (targetAttach.top) { |
| 329 | this.add.push( |
| 330 | `${getClass('target-attached', classes, classPrefix)}-${ |
| 331 | targetAttach.top |
| 332 | }` |
| 333 | ); |
| 334 | } |
| 335 | if (targetAttach.left) { |
| 336 | this.add.push( |
| 337 | `${getClass('target-attached', classes, classPrefix)}-${ |
| 338 | targetAttach.left |
| 339 | }` |
| 340 | ); |
| 341 | } |
| 342 | |
| 343 | this.all = []; |
| 344 | sides.forEach((side) => { |
| 345 | this.all.push( |
| 346 | `${getClass('element-attached', classes, classPrefix)}-${side}` |
| 347 | ); |
| 348 | this.all.push( |
| 349 | `${getClass('target-attached', classes, classPrefix)}-${side}` |
| 350 | ); |
| 351 | }); |
| 352 | |
| 353 | defer(() => { |
no test coverage detected