<commit_before>Scene = require('../elements/scene')

Script = require('../elements/script')
Box = require('../elements/box')
Spawn = require('../elements/spawn')
Model = require('../elements/model')
Link = require('../elements/link')
Skybox = require('../elements/skybox')
Audio = require('../elements/audio')

describe 'constructor', ->
  it 'should create', ->
    s = new Scene "scene"
    expect(s instanceof Scene).toBeTruthy()
    expect(s.nodeName).toEqual 'scene'

describe 'scene', ->
  it 'should load scene', ->
    Scene.load process.cwd() + '/spec/fixtures/hello.xml', (scene) ->
      expect(scene.childNodes.length).toEqual(7)

      box = scene.childNodes[1]
      expect(box instanceof Box).toBeTruthy()
      expect(box.getAttribute("color")).toEqual "#FF00AA"
      expect(box.color.red()).toEqual 255
      expect(box.position.y).toEqual 10.0

      script = scene.childNodes[5]
      expect(script instanceof Script).toBeTruthy()

  it 'should load scene with <script /> tags', ->
    Scene.load process.cwd() + '/spec/fixtures/script_tag.xml', (scene) ->
      expect(scene.childNodes.length).toEqual(5)

      script = scene.childNodes[3]
      expect(script instanceof Script).toBeTruthy()
      expect(script.textContent).toMatch /10 < 20/

describe 'compartmentalization', ->
  xml1 = "<scene><script>document.foo = 'bar';</script></scene>"
  xml2 = "<scene><script>console.dump(document.foo)</script></scene>"
<commit_msg>Disable spec that requires mocked reflectors.<commit_after>Scene = require('../elements/scene')

Script = require('../elements/script')
Box = require('../elements/box')
Spawn = require('../elements/spawn')
Model = require('../elements/model')
Link = require('../elements/link')
Skybox = require('../elements/skybox')
Audio = require('../elements/audio')

describe 'constructor', ->
  it 'should create', ->
    s = new Scene "scene"
    expect(s instanceof Scene).toBeTruthy()
    expect(s.nodeName).toEqual 'scene'

describe 'scene', ->
  it 'should load scene', ->
    Scene.load process.cwd() + '/spec/fixtures/hello.xml', (scene) ->
      expect(scene.childNodes.length).toEqual(7)

      box = scene.childNodes[1]
      expect(box instanceof Box).toBeTruthy()
      expect(box.getAttribute("color")).toEqual "#FF00AA"
      expect(box.color.red()).toEqual 255
      expect(box.position.y).toEqual 10.0

      script = scene.childNodes[5]
      expect(script instanceof Script).toBeTruthy()

  it 'should load scene with <script /> tags', ->
    Scene.load process.cwd() + '/spec/fixtures/script_tag.xml', (scene) ->
      expect(scene.childNodes.length).toEqual(5)

      script = scene.childNodes[3]
      expect(script instanceof Script).toBeTruthy()
      expect(script.textContent).toMatch /10 < 20/

xdescribe 'compartmentalization', ->
  xml1 = "<scene><script>document.foo = 'bar';</script></scene>"
  xml2 = "<scene><script>console.dump(document.foo)</script></scene>"

{'fraction_non_alphanumeric': 0.1784373933810986, 'fraction_numerical': 0.012964858410098942, 'mean_word_length': 3.6912, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '3477732', 'n_tokens_mistral': 933, 'n_tokens_neox': 904, 'n_words': 173}