<commit_before>kd                    = require 'kd'
mock                  = require '../../../../mocks/mockingjay'
nick                  = require 'app/util/nick'
expect                = require 'expect'
IDEAce                = require 'ide/views/ace/ideace'
FSFile                = require 'app/util/fs/fsfile'
FSHelper              = require 'app/util/fs/fshelper'
IDEView               = require 'ide/views/tabview/ideview'
IDEHelpers            = require '../../../lib/idehelpers'
WebTermView           = require 'app/terminal/webtermview'
AppController         = require 'app/appcontroller'
IDEEditorPane         = require 'ide/workspace/panes/ideeditorpane'
IDETailerPane         = require 'ide/workspace/panes/idetailerpane'
IDETerminalPane       = require 'ide/workspace/panes/ideterminalpane'
IDEDrawingPane        = require 'ide/workspace/panes/idedrawingpane'
showErrorNotification = require 'app/util/showErrorNotification'
IDEApplicationTabView = require 'ide/views/tabview/ideapplicationtabview'

ideView                     = null
handlePaneRemovedSpy        = null
showErrorNotificationSpy    = null
revertShowErrorNotification = null


initSpies = ->

  expect.spyOn IDEView.prototype, 'updateStatusBar'
  expect.spyOn IDEView.prototype, 'bindListeners'
  expect.spyOn IDEView.prototype, 'trimUntitledFileName'
  handlePaneRemovedSpy = expect.spyOn IDEView.prototype, 'handlePaneRemoved'

  showErrorNotificationSpy    = expect.createSpy()
  revertShowErrorNotification = IDEView.__set__ 'showErrorNotification', showErrorNotificationSpy


createFile = (path = 'foo/path') ->

  machine = mock.getMockMachine()
  return FSHelper.createFileInstance { path, machine }


createEditorPane = (paneClass) ->

  file    = FSHelper.createFileInstance path: '/foo/bar'
  content = 'Foo bar baz waz here'
  options = { name: 'Foo Bar' }

  clazz      = paneClass or IDEEditorPane
  ideView    = new IDEView
  editorPane = new clazz { file, content }

  expect.spyOn(ideView.tabView, 'addPane').andCallThrough()

  pane = ideView.createPane_ editorPane, options, file

  return { ideView, editorPane, pane, file }


createTerminalPane = (options = {}) ->

  app = new AppController
  app.workspaceData = { rootPath: '/root/path' }

  mock.appManager.getFrontApp.toReturnPassedParam app

  options.machine = mock.getMockMachine()
  pane = ideView.createTerminal options

  return pane


describe 'IDEView', ->


  beforeEach ->

    initSpies()
    ideView = new IDEView


  afterEach ->

    expect.restoreSpies()<commit_msg>Tests: IDEView: Pass name to app controllers.<commit_after>kd                    = require 'kd'
mock                  = require '../../../../mocks/mockingjay'
nick                  = require 'app/util/nick'
expect                = require 'expect'
IDEAce                = require 'ide/views/ace/ideace'
FSFile                = require 'app/util/fs/fsfile'
FSHelper              = require 'app/util/fs/fshelper'
IDEView               = require 'ide/views/tabview/ideview'
IDEHelpers            = require '../../../lib/idehelpers'
WebTermView           = require 'app/terminal/webtermview'
AppController         = require 'app/appcontroller'
IDEEditorPane         = require 'ide/workspace/panes/ideeditorpane'
IDETailerPane         = require 'ide/workspace/panes/idetailerpane'
IDETerminalPane       = require 'ide/workspace/panes/ideterminalpane'
IDEDrawingPane        = require 'ide/workspace/panes/idedrawingpane'
showErrorNotification = require 'app/util/showErrorNotification'
IDEApplicationTabView = require 'ide/views/tabview/ideapplicationtabview'

ideView                     = null
handlePaneRemovedSpy        = null
showErrorNotificationSpy    = null
revertShowErrorNotification = null


initSpies = ->

  expect.spyOn IDEView.prototype, 'updateStatusBar'
  expect.spyOn IDEView.prototype, 'bindListeners'
  expect.spyOn IDEView.prototype, 'trimUntitledFileName'
  handlePaneRemovedSpy = expect.spyOn IDEView.prototype, 'handlePaneRemoved'

  showErrorNotificationSpy    = expect.createSpy()
  revertShowErrorNotification = IDEView.__set__ 'showErrorNotification', showErrorNotificationSpy


createFile = (path = 'foo/path') ->

  machine = mock.getMockMachine()
  return FSHelper.createFileInstance { path, machine }


createEditorPane = (paneClass) ->

  file    = FSHelper.createFileInstance path: '/foo/bar'
  content = 'Foo bar baz waz here'
  options = { name: 'Foo Bar' }

  clazz      = paneClass or IDEEditorPane
  ideView    = new IDEView
  editorPane = new clazz { file, content }

  expect.spyOn(ideView.tabView, 'addPane').andCallThrough()

  pane = ideView.createPane_ editorPane, options, file

  return { ideView, editorPane, pane, file }


createTerminalPane = (options = {}) ->

  app = new AppController { name: "FooApp#{Date.now()}"}
  app.workspaceData = { rootPath: '/root/path' }

  mock.appManager.getFrontApp.toReturnPassedParam app

  options.machine = mock.getMockMachine()
  pane = ideView.createTerminal options

  return pane


describe 'IDEView', ->


  beforeEach ->

    initSpies()
    ideView = new IDEView


  afterEach ->

    expect.restoreSpies()
{'fraction_non_alphanumeric': 0.10185365853658536, 'fraction_numerical': 0.0, 'mean_word_length': 3.055379746835443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '5100899', 'n_tokens_mistral': 1616, 'n_tokens_neox': 1535, 'n_words': 315}