Lua: fix placement of tests for Block elements in pandoc module tests

This commit is contained in:
Albert Krewinkel 2021-10-28 14:10:54 +02:00
parent af97598954
commit e1cf0ad1be
No known key found for this signature in database
GPG key ID: 388DC0B21F631124

View file

@ -105,6 +105,49 @@ return {
assert.are_equal(count, 3) assert.are_equal(count, 3)
end) end)
}, },
group 'HTML-like attribute tables' {
test('in element constructor', function ()
local html_attributes = {
id = 'the-id',
class = 'class1 class2',
width = '11',
height = '12'
}
local attr = pandoc.Span('test', html_attributes).attr
assert.are_equal(attr.identifier, 'the-id')
assert.are_equal(attr.classes[1], 'class1')
assert.are_equal(attr.classes[2], 'class2')
assert.are_equal(attr.attributes.width, '11')
assert.are_equal(attr.attributes.height, '12')
end),
test('element attr setter', function ()
local html_attributes = {
id = 'the-id',
class = 'class1 class2',
width = "11",
height = "12"
}
local span = pandoc.Span 'test'
span.attr = html_attributes
span = span:clone() -- normalize
assert.are_equal(span.attr.identifier, 'the-id')
assert.are_equal(span.attr.classes[1], 'class1')
assert.are_equal(span.attr.classes[2], 'class2')
assert.are_equal(span.attr.attributes.width, '11')
assert.are_equal(span.attr.attributes.height, '12')
end),
test('element attrbutes setter', function ()
local attributes = {
width = "11",
height = "12"
}
local span = pandoc.Span 'test'
span.attributes = attributes
assert.are_equal(span.attr.attributes.width, '11')
assert.are_equal(span.attr.attributes.height, '12')
end)
}
},
group "Block elements" { group "Block elements" {
group "BulletList" { group "BulletList" {
test('access items via property `content`', function () test('access items via property `content`', function ()
@ -223,50 +266,7 @@ return {
} }
) )
end) end)
}
}, },
group 'HTML-like attribute tables' {
test('in element constructor', function ()
local html_attributes = {
id = 'the-id',
class = 'class1 class2',
width = '11',
height = '12'
}
local attr = pandoc.Span('test', html_attributes).attr
assert.are_equal(attr.identifier, 'the-id')
assert.are_equal(attr.classes[1], 'class1')
assert.are_equal(attr.classes[2], 'class2')
assert.are_equal(attr.attributes.width, '11')
assert.are_equal(attr.attributes.height, '12')
end),
test('element attr setter', function ()
local html_attributes = {
id = 'the-id',
class = 'class1 class2',
width = "11",
height = "12"
}
local span = pandoc.Span 'test'
span.attr = html_attributes
span = span:clone() -- normalize
assert.are_equal(span.attr.identifier, 'the-id')
assert.are_equal(span.attr.classes[1], 'class1')
assert.are_equal(span.attr.classes[2], 'class2')
assert.are_equal(span.attr.attributes.width, '11')
assert.are_equal(span.attr.attributes.height, '12')
end),
test('element attrbutes setter', function ()
local attributes = {
width = "11",
height = "12"
}
local span = pandoc.Span 'test'
span.attributes = attributes
assert.are_equal(span.attr.attributes.width, '11')
assert.are_equal(span.attr.attributes.height, '12')
end)
}
}, },
group 'Other types' { group 'Other types' {
group 'SimpleTable' { group 'SimpleTable' {