<commit_before>import { Component, DefaultDOMElement, platform } from 'substance'

export default class TextureAppChrome extends Component {
  didMount () {
    // when the developer console is not open, display when there is an error
    if (!platform.devtools) {
      this._init(err => {
        if (err) {
          console.error(err)
          this.setState({ error: err })
        }
      })
    } else {
      this._init()
    }
    DefaultDOMElement.getBrowserWindow().on('keydown', this._keyDown, this)
    DefaultDOMElement.getBrowserWindow().on('drop', this._supressDnD, this)
    DefaultDOMElement.getBrowserWindow().on('dragover', this._supressDnD, this)
  }

  dispose () {
    DefaultDOMElement.getBrowserWindow().off(this)
  }

  getChildContext () {
    return this._childContext || {}
  }
<commit_msg>Do not register global DOM hooks when running tests.<commit_after>import { Component, DefaultDOMElement, platform } from 'substance'

export default class TextureAppChrome extends Component {
  didMount () {
    // when the developer console is not open, display when there is an error
    if (!platform.devtools) {
      this._init(err => {
        if (err) {
          console.error(err)
          this.setState({ error: err })
        }
      })
    } else {
      this._init()
    }
    // Note: adding global handlers causes problems in the test suite
    if (!platform.test) {
      DefaultDOMElement.getBrowserWindow().on('keydown', this._keyDown, this)
      DefaultDOMElement.getBrowserWindow().on('drop', this._supressDnD, this)
      DefaultDOMElement.getBrowserWindow().on('dragover', this._supressDnD, this)
    }
  }

  dispose () {
    DefaultDOMElement.getBrowserWindow().off(this)
  }

  getChildContext () {
    return this._childContext || {}
  }

{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.0, 'mean_word_length': 3.004484304932735, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7624361', 'n_tokens_mistral': 530, 'n_tokens_neox': 516, 'n_words': 122}