summaryrefslogtreecommitdiff
path: root/spec/table_spec.rb
blob: 653d9ea0928a22296f4e822763f0713ff8b85f44 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# frozen_string_literal: true

require_relative 'spec_helper'

describe 'Asciidoctor::Epub3::Converter - Table' do
  it 'supports halign' do
    book = to_epub <<~EOS
      = Article

      |===
      >| Text
      |===
    EOS
    article = book.item_by_href '_article.xhtml'
    expect(article).not_to be_nil
    expect(article.content).to include '<td class="halign-right valign-top"><p class="tableblock">Text</p></td>'
  end

  it 'supports valign' do
    book = to_epub <<~EOS
      = Article

      |===
      .>| Text
      |===
    EOS
    article = book.item_by_href '_article.xhtml'
    expect(article).not_to be_nil
    expect(article.content).to include '<td class="halign-left valign-bottom"><p class="tableblock">Text</p></td>'
  end

  it 'supports colwidth' do
    book = to_epub <<~EOS
      = Article

      [cols="3,1"]
      |===
      | A | B
      |===
    EOS
    article = book.item_by_href '_article.xhtml'
    expect(article).not_to be_nil
    expect(article.content).to include '
<colgroup>
<col style="width: 75%;" />
<col style="width: 25%;" />
</colgroup>
'
  end
end