<commit_before>describe("app.views.ServicesSelector", function(){
  beforeEach(function(){
    loginAs({
      services : [
        { provider : "facebook" }
      ]
    });

    this.view = new app.views.ServicesSelector();
  });

  describe("rendering", function(){
    beforeEach(function(){
      this.view.setElement("#jasmine_content")
      this.view.render();
    });

    it("displays all services", function(){
      var checkboxes = $(this.view.el).find('input[type="checkbox"]');
      expect(checkboxes.val()).toBe("facebook");
    });

    // this tests the crazy css we have in a bassackwards way
    // check out toggling the services on the new publisher and make sure it works if you change stuff.
    it("selects the checkbox when the image is clicked", function(){
      expect($("label[for=service_toggle_facebook] img").css("opacity")).toBeLessThan(0.8) //floating point weirdness, be safe.
      this.view.$("input[value='facebook']").select()

        waitsFor(function(){
          return $("label[for=service_toggle_facebook] img").css("opacity") == 1
      })
    })
  });

  describe("askForAuth", function() {
    beforeEach( function(){
      this.evt = jQuery.Event("click");
      this.evt.target = "<label data-url='testing' data-provider='facebook'>"

      spyOn(window, "open")
    });

    it("opens a window if app.currentUser does not have the service configured", function() {
      app.currentUser.set({configured_services : []})
      this.view.askForAuth(this.evt)<commit_msg>hopefully fix another weirdly fluctuating test failure<commit_after>describe("app.views.ServicesSelector", function(){
  beforeEach(function(){
    loginAs({
      services : [
        { provider : "facebook" }
      ]
    });

    this.view = new app.views.ServicesSelector();
  });

  describe("rendering", function(){
    beforeEach(function(){
      this.view.setElement("#jasmine_content")
      this.view.render();
    });

    it("displays all services", function(){
      var checkboxes = $(this.view.el).find('input[type="checkbox"]');
      expect(checkboxes.val()).toBe("facebook");
    });

    // this tests the crazy css we have in a bassackwards way
    // check out toggling the services on the new publisher and make sure it works if you change stuff.
    it("selects the checkbox when the image is clicked", function(){
      waitsFor(function() {
        return ($("label[for=service_toggle_facebook] img").css("opacity") < 0.8);
      });

      runs(function() {
        expect($("label[for=service_toggle_facebook] img").css("opacity")).toBeLessThan(0.8) //floating point weirdness, be safe.
        this.view.$("input[value='facebook']").select()
      });

      waitsFor(function(){
        return $("label[for=service_toggle_facebook] img").css("opacity") == 1
      });

      runs(function() {
        expect($("label[for=service_toggle_facebook] img").css("opacity")).toBeGreaterThan(0.8) //floating point weirdness, be safe.
      });
    })
  });

  describe("askForAuth", function() {
    beforeEach( function(){
      this.evt = jQuery.Event("click");
      this.evt.target = "<label data-url='testing' data-provider='facebook'>"

      spyOn(window, "open")
    });

    it("opens a window if app.currentUser does not have the service configured", function() {
      app.currentUser.set({configured_services : []})
      this.view.askForAuth(this.evt)
{'fraction_non_alphanumeric': 0.16128084606345475, 'fraction_numerical': 0.002937720329024677, 'mean_word_length': 3.3210659898477157, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '2649726', 'n_tokens_mistral': 997, 'n_tokens_neox': 973, 'n_words': 219}