import Component from '@ember/component';
import { alias } from '@ember/object/computed';
import { computed } from '@ember/object';
import $ from 'jquery';

import RlDropdownContainer from './rl-dropdown-container';

export default Component.extend({
  classNames: ['rl-dropdown'],
  classNameBindings: ['isExpanded:open'],

  dropdownContainer: computed(function() {
    return this.nearestOfType(RlDropdownContainer);
  }),

  isExpanded: alias('dropdownContainer.dropdownExpanded'),

  click(event) {
    let closeOnChildClick = 'a:link';
    let $target = event.target;
    let $c = this.element;

    if ($target !== $c) {
      if ((closeOnChildClick === true || closeOnChildClick === 'true') && $target.closest($c).length) {
        this.set('isExpanded', false);
      } else if (closeOnChildClick && $target.closest(closeOnChildClick, $c).length) {
        this.set('isExpanded', false);
      }
    }
  },
});

@@ -615,9 +615,9 @@
 get 
-!
+=
 == $
@@ -631,183 +631,31 @@
     
-if ((closeOnChildClick === true %7C%7C closeOnChildClick === 'true') && $target.closest($c).length) %7B%0A        this.set('isExpanded', false);%0A      %7D else if (closeOnChildClick && 
+return;%0A    %7D%0A%0A    if (
 $tar
@@ -705,18 +705,16 @@
 %7B%0A      
-  
 this.set
@@ -740,16 +740,8 @@
 e);%0A
-      %7D%0A
     

remove conditional logic that does nothing