<commit_before>'use strict';

/* https://github.com/angular/protractor/blob/master/docs/getting-started.md */

describe('sn.smartNav', function() {
  describe('snSmartNav directive', function() {

    var nav = {},
        secondNav = {};

    beforeEach(function(){
      browser.manage().deleteAllCookies();
      browser.get('http://127.0.0.1:8000/');
      browser.waitForAngular();
      browser.driver.sleep(2000);
      nav = element.all(by.css('nav.first')).first();
      secondNav = element.all(by.css('nav.second')).first();
    });

    it('should not contain any classes from smartNav directive', function() {
      browser.executeScript('scrollTo(0,0)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).not.toContain('scrolling-down');
      expect(nav.getAttribute('class')).not.toContain('scrolling-up');
      expect(nav.getAttribute('class')).not.toContain('minimised-mode');
    });

    it('should add "scrolling-down" class', function() {
      expect(nav.getAttribute('class')).not.toContain('scrolling-down');
      browser.executeScript('scrollTo(0,100)');
      browser.executeScript('scrollTo(0,200)');
      browser.executeScript('scrollTo(0,300)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).toContain('scrolling-down');
    });

    it('should add "scrolling-up" class', function() {
      browser.executeScript('scrollTo(0,400)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).not.toContain('scrolling-up');

      browser.executeScript('scrollTo(0,300)');
      browser.executeScript('scrollTo(0,200)');
      browser.executeScript('scrollTo(0,100)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).toContain('scrolling-up');
    });

    it('should add "minimised-mode" class', function() {
      browser.executeScript('scrollTo(0,0)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).not.toContain('minimised-mode');

      browser.executeScript('scrollTo(0,100)');
      browser.executeScript('scrollTo(0,200)');
      browser.executeScript('scrollTo(0,300)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).toContain('minimised-mode');
    });

    it('should add "affix" class', function() {
      browser.executeScript('scrollTo(0,0)');
      browser.driver.sleep(2000);
      expect(secondNav.getAttribute('class')).not.toContain('affix');

      browser.executeScript('scrollTo(0,100)');
      browser.executeScript('scrollTo(0,200)');
      browser.driver.sleep(2000);
      expect(secondNav.getAttribute('class')).toContain('affix');

      browser.executeScript('scrollTo(0,300)');
      browser.driver.sleep(2000);
      expect(secondNav.getAttribute('class')).toContain('affix');
    });

  });
});<commit_msg>add e2e tests<commit_after>'use strict';

/* https://github.com/angular/protractor/blob/master/docs/getting-started.md */

describe('sn.smartNav', function() {
  describe('snSmartNav directive', function() {

    var nav = {},
        secondNav = {};

    beforeEach(function(){
      browser.manage().deleteAllCookies();
      browser.get('http://127.0.0.1:8000/');
      browser.waitForAngular();
      browser.driver.sleep(2000);
      nav = element.all(by.css('nav.first')).first();
      secondNav = element.all(by.css('nav.second')).first();
    });

    it('should not contain any classes from smartNav directive', function() {
      browser.executeScript('scrollTo(0,0)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).not.toContain('scrolling-down');
      expect(nav.getAttribute('class')).not.toContain('scrolling-up');
      expect(nav.getAttribute('class')).not.toContain('minimised-mode');
    });

    it('should add "scrolling-down" class', function() {
      expect(nav.getAttribute('class')).not.toContain('scrolling-down');
      browser.executeScript('scrollTo(0,100)');
      browser.executeScript('scrollTo(0,200)');
      browser.executeScript('scrollTo(0,300)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).toContain('scrolling-down');
    });

    it('should add "scrolling-up" class', function() {
      browser.executeScript('scrollTo(0,400)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).not.toContain('scrolling-up');

      browser.executeScript('scrollTo(0,300)');
      browser.executeScript('scrollTo(0,200)');
      browser.executeScript('scrollTo(0,100)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).toContain('scrolling-up');
    });

    it('should add "minimised-mode" class', function() {
      browser.executeScript('scrollTo(0,0)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).not.toContain('minimised-mode');

      browser.executeScript('scrollTo(0,100)');
      browser.executeScript('scrollTo(0,200)');
      browser.executeScript('scrollTo(0,300)');
      browser.driver.sleep(2000);
      expect(nav.getAttribute('class')).toContain('minimised-mode');
    });

    it('should add "affix" class', function() {
      browser.executeScript('scrollTo(0,0)');
      browser.driver.sleep(2000);
      expect(secondNav.getAttribute('class')).not.toContain('affix');

      browser.executeScript('scrollTo(0,100)');
      browser.executeScript('scrollTo(0,200)');
      browser.driver.sleep(2000);
      expect(secondNav.getAttribute('class')).toContain('affix');

      browser.executeScript('scrollTo(0,300)');
      browser.driver.sleep(2000);
      expect(secondNav.getAttribute('class')).toContain('affix');

      browser.executeScript('scrollTo(0,0)');
      browser.driver.sleep(2000);
      expect(secondNav.getAttribute('class')).not.toContain('affix');

    });

  });
});
{'fraction_non_alphanumeric': 0.19067357512953367, 'fraction_numerical': 0.0385146804835924, 'mean_word_length': 4.07092819614711, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6932854', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1793, 'n_words': 177}