What does the "it" function do in this code?

See the Jasmine testing framework.

The it(...) function defines a test case (aka a "spec").

describe("A suite", function() {
  it("contains spec with an expectation", function() {
    expect(true).toBe(true);
  });
});

Note that AngularJS E2E Testing...

... uses Jasmine for its test syntax.


So 'it' is referring to when you're testing your application, and only when you're testing. The point of testing is that you can have the test runner automate a bunch of the regular tasks your users would normally do then validate all the responses/events from those tasks work correctly. What your code is saying is that your test 'should check ng-show/ng-hide' and validate that they're working properly. You'll only see 'it' used in test runner like Karma or Jasmine.