<commit_before>{Testing, expect, sinon, _} = require '../helpers/component-testing'

Chapter = require '../../../src/components/learning-guide/chapter'

GUIDE = require '../../../api/user/courses/1/guide.json'

describe 'Learning Guide Chapter Panel', ->


  beforeEach ->
    @props = {
      chapter: GUIDE.children[0]
      courseId: '1'
      onPractice: sinon.spy()
    }

  it 'renders expanded and can be toggled', ->
    Testing.renderComponent( Chapter, props: @props ).then ({dom}) ->
      expect(_.toArray(dom.classList)).to.include('expanded')
      expect(dom.querySelector('.view-toggle').textContent).to.equal('View Less')
      Testing.actions.clickButton(dom, '.view-toggle')
      expect(_.toArray(dom.classList)).to.include('collapsed')
      expect(_.toArray(dom.classList)).to.not.include('expanded')
      expect(dom.querySelector('.view-toggle').textContent).to.equal('View More')

  it 'reports how many problems were worked', ->
    Testing.renderComponent( Chapter, props: @props ).then ({dom}) ->
      expect(dom.querySelector('.amount-worked').textContent).to.equal('10 problems worked')

  it 'displays the title', ->
    Testing.renderComponent( Chapter, props: @props ).then ({dom}) =>
      expect(dom.querySelector('.chapter-title').textContent).to.equal(@props.chapter.title)
<commit_msg>removed toggle button test<commit_after>{Testing, expect, sinon, _} = require '../helpers/component-testing'

Chapter = require '../../../src/components/learning-guide/chapter'

GUIDE = require '../../../api/user/courses/1/guide.json'

describe 'Learning Guide Chapter Panel', ->


  beforeEach ->
    @props = {
      chapter: GUIDE.children[0]
      courseId: '1'
      onPractice: sinon.spy()
    }

  # it 'renders expanded and can be toggled', ->
  #   Testing.renderComponent( Chapter, props: @props ).then ({dom}) ->
  #     expect(_.toArray(dom.classList)).to.include('expanded')
  #     expect(dom.querySelector('.view-toggle').textContent).to.equal('View Less')
  #     Testing.actions.clickButton(dom, '.view-toggle')
  #     expect(_.toArray(dom.classList)).to.include('collapsed')
  #     expect(_.toArray(dom.classList)).to.not.include('expanded')
  #     expect(dom.querySelector('.view-toggle').textContent).to.equal('View More')

  it 'reports how many problems were worked', ->
    Testing.renderComponent( Chapter, props: @props ).then ({dom}) ->
      expect(dom.querySelector('.amount-worked').textContent).to.equal('10 problems worked')

  it 'displays the title', ->
    Testing.renderComponent( Chapter, props: @props ).then ({dom}) =>
      expect(dom.querySelector('.chapter-title').textContent).to.equal(@props.chapter.title)

{'fraction_non_alphanumeric': 0.17930519237952933, 'fraction_numerical': 0.0037355248412401943, 'mean_word_length': 3.6818181818181817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '6339760', 'n_tokens_mistral': 827, 'n_tokens_neox': 801, 'n_words': 149}