<commit_before>_ = require 'underscore'
benv = require 'benv'
sinon = require 'sinon'
Backbone = require 'backbone'
Article = require '../../../models/article'
Articles = require '../../../collections/articles'
CurrentUser = require '../../../models/current_user'
fixtures = require '../../../test/helpers/fixtures.coffee'
sd = require('sharify').data
{ resolve } = require 'path'
{ fabricate } = require 'antigravity'
{ stubChildClasses } = require '../../../test/helpers/stubs'

describe 'ArticleView', ->

  before (done) ->
    benv.setup =>
      benv.expose $: benv.require 'jquery'
      $.fn.imagesLoaded = sinon.stub()
      Backbone.$ = $
      sd.SCROLL_ARTICLE = 'static'
      @ArticleView = benv.requireWithJadeify(
        resolve(__dirname, '../view')
        ['artworkItemTemplate', 'editTemplate']
      )
      @ArticleView.__set__ 'CurrentUser', { orNull: ->
        new CurrentUser _.extend( fabricate('user') , { 'id' : '4d8cd73191a5c50ce210002a' } ) }
      @ArticleView.__set__ 'imagesLoaded', sinon.stub()
      stubChildClasses @ArticleView, this,
        ['initCarousel']
        []
      benv.render resolve(__dirname, '../templates/index.jade'), @locals = {
        footerArticles: new Backbone.Collection
        slideshowArtworks: null
        article: @article = new Article _.extend fixtures.article,
          sections: [
            { type: 'text', body: 'Foo' }
            {
              type: 'artworks',
              ids: ['5321b73dc9dc2458c4000196', '5321b71c275b24bcaa0001a5'],
              layout: 'overflow_fillwidth'
            }
        ]
        author: new Backbone.Model fabricate 'user'
        sd:<commit_msg>stubs sticky on article view test<commit_after>_ = require 'underscore'
benv = require 'benv'
sinon = require 'sinon'
Backbone = require 'backbone'
Article = require '../../../models/article'
Articles = require '../../../collections/articles'
CurrentUser = require '../../../models/current_user'
fixtures = require '../../../test/helpers/fixtures.coffee'
sd = require('sharify').data
{ resolve } = require 'path'
{ fabricate } = require 'antigravity'
{ stubChildClasses } = require '../../../test/helpers/stubs'

describe 'ArticleView', ->

  before (done) ->
    benv.setup =>
      benv.expose $: benv.require 'jquery'
      $.fn.imagesLoaded = sinon.stub()
      Backbone.$ = $
      sd.SCROLL_ARTICLE = 'static'
      @ArticleView = benv.requireWithJadeify(
        resolve(__dirname, '../view')
        ['artworkItemTemplate', 'editTemplate']
      )
      @ArticleView.__set__ 'CurrentUser', { orNull: ->
        new CurrentUser _.extend( fabricate('user') , { 'id' : '4d8cd73191a5c50ce210002a' } ) }
      @ArticleView.__set__ 'imagesLoaded', sinon.stub()
      @ArticleView.__set__ 'Sticky', -> { add: sinon.stub() }
      stubChildClasses @ArticleView, this,
        ['initCarousel']
        []
      benv.render resolve(__dirname, '../templates/index.jade'), @locals = {
        footerArticles: new Backbone.Collection
        slideshowArtworks: null
        article: @article = new Article _.extend fixtures.article,
          sections: [
            { type: 'text', body: 'Foo' }
            {
              type: 'artworks',
              ids: ['5321b73dc9dc2458c4000196', '5321b71c275b24bcaa0001a5'],
              layout: 'overflow_fillwidth'
            }
        ]
        author: new Backbone.Model fabricate 'user'
        sd:
{'fraction_non_alphanumeric': 0.153462441314554, 'fraction_numerical': 0.029342723004694836, 'mean_word_length': 2.507201646090535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '2345949', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1057, 'n_words': 214}