Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (35 sloc) 1.58 KB

#jQuery Overview For instructions on how to run the tests, check the following link: https://github.com/TelerikAcademy/JavaScript-UI-and-DOM/blob/master/README.md#user-content-preparing-the-local-machine-for-unit-testing-with-mocha-and-chai

##Task 1 Create a function that takes a selector and COUNT, then generates inside a UL with COUNT LIs:

  • The UL must have a class items-list
  • Each of the LIs must:
    • have a class list-item
    • content "List item #INDEX"
      • The indices are zero-based
  • If the provided selector does not selects anything, do nothing
  • Throws if
    • COUNT is a Number, but is less than 1
    • COUNT is missing, or not convertible to Number
      • Example:
        • Valid COUNT values:
          • 1, 2, 3, '1', '4', '1123'
        • Invalid COUNT values:
          • '123px' 'John', {}, []

##Task 2 Create a function that takes a selector and:

  • Finds all elements with class button or content within the provided element
    • Change the content of all .button elements with "hide"
  • When a .button is clicked:
    • Find the topmost .content element, that is before another .button and:
      • If the .content is visible:
        • Hide the .content
        • Change the content of the .button to "show"
      • If the .content is hidden:
        • Show the .content
        • Change the content of the .button to "hide"
      • If there isn't a .content element after the clicked .button and before other .button, do nothing
  • Throws if:
    • The provided ID is not a jQuery object or a string
  • Use jQuery!
You can’t perform that action at this time.