File: element_spec.rb

package info (click to toggle)
ruby-mathml 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 516 kB
  • sloc: ruby: 10,090; makefile: 10
file content (32 lines) | stat: -rw-r--r-- 683 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'math_ml'

describe MathML::Element do
  it '#display_style and #as_display_style' do
    expect(MathML::Element.new('test').display_style).to be_nil
    e = MathML::Element.new('test')
    r = e.as_display_style
    expect(r).to equal(e)
    expect(e.display_style).to be true
  end

  it '#pop' do
    e = MathML::Element.new('super')
    s = MathML::Element.new('sub')

    expect(e.pop).to be_nil

    e << s
    expect(e.pop).to equal(s)
    expect(e.pop).to be_nil

    e << 'text'
    expect(e.pop).to eq('text')
    expect(e.pop).to be_nil
  end

  it '#to_s' do
    e = MathML::Element.new('e')
    e << 'test<'
    expect(e.to_s).to eq('<e>test&lt;</e>')
  end
end