• Thomas Randolph's avatar
    Extract and refactor dropdown item rendering · 23993e8c
    Thomas Randolph authored
    Basic Intent: Allow all branch names without accidentally creating
    layout or backstage DOM. e.g. a branch named `separator` should never
    create a separator `li` element.  
    
    Ideally, there should never be a string that could cause this kind of 
    conflict.  
    
    Implementation: All of `GitLabDropdown.renderItem` is extracted to a 
    standalone module.  
    
    To render a divider or separator, consumers must now pass in an object 
    like `{ "type": "divider" }` or `{ "type": "separator" }`   
    
    Notable choices:  
    - All of the functions have a cyclomatic complexity of 3 or less
        - See: https://en.wikipedia.org/wiki/Cyclomatic_complexity
        - Note the "Correlation to number of defects" section
        - While software complexity may not have a directly causal
          relationship with defects, less complex software is generally
          easier to reason about, and **may** reduce defects.
          I personally try to maintain complexity of no higher than 3.
    - Everything other than the branch names fix matches past behavior 
    exactly
        - Including:
            - Unused variables
            - Class list order
    23993e8c
access_dropdown.js 13.5 KB