Module:Infobox mapframe/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>Hike395
allow unprefixed captionstyle
 
imported>Hike395
allow unprefixed captionstyle
 
(No difference)

Latest revision as of 14:47, 18 November 2025

local p = require('Module:UnitTests')

function p:test_auto()
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|auto|onByDefault=yes}}',
                                      '{{#invoke:Infobox mapframe/sandbox|auto|onByDefault=yes}}',
                                      {stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|auto|onByDefault=yes|id=Q100}}',
                                      '{{#invoke:Infobox mapframe/sandbox|auto|onByDefault=yes|id=Q100}}',
                                      {stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|auto|onByDefault=no|id=Q100}}',
                                      '{{#invoke:Infobox mapframe/sandbox|auto|onByDefault=no|id=Q100}}',
                                      {stripmarker=1})
end

function p:test_autocaption()
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autocaption|onByDefault=yes|mapframe-caption=Boston}}',
                                      '{{#invoke:Infobox mapframe/sandbox|autocaption|onByDefault=yes|mapframe-caption=Boston}}',
                                      {stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autocaption|onByDefault=yes|id=Q100}}',
                                      '{{#invoke:Infobox mapframe/sandbox|autocaption|onByDefault=yes|id=Q100}}',
                                      {stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autocaption|onByDefault=yes|id=Q100|mapframe-caption=Boston}}',
                                      '{{#invoke:Infobox mapframe/sandbox|autocaption|onByDefault=yes|id=Q100|mapframe-caption=Boston}}',
                                      {stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autocaption|onByDefault=no|id=Q100|mapframe-caption=Boston}}',
                                      '{{#invoke:Infobox mapframe/sandbox|autocaption|onByDefault=no|id=Q100|mapframe-caption=Boston}}',
                                      {stripmarker=1})
end

function p:test_autoWithCaption_main()
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autoWithCaption|onByDefault=yes|mapframe-caption=Boston}}','',
                                      {stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autoWithCaption|onByDefault=yes|id=Q100}}',
                                      '{{#invoke:Infobox mapframe|auto|onByDefault=yes|id=Q100}}'
                                      ..'<div class="infobox-caption">'
                                      ..'{{#invoke:Infobox mapframe|autocaption|onByDefault=yes|id=Q100}}'
                                      ..'</div>',{stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autoWithCaption|onByDefault=yes|id=Q100|mapframe-caption=Boston}}',
                                      '{{#invoke:Infobox mapframe|auto|onByDefault=yes|id=Q100|mapframe-caption=Boston}}'
                                      ..'<div class="infobox-caption">'
                                      ..'{{#invoke:Infobox mapframe|autocaption|onByDefault=yes|id=Q100|mapframe-caption=Boston}}'
                                      ..'</div>',{stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autoWithCaption|onByDefault=yes'
                                      ..'|id=Q100|mapframe-caption=Boston|mapframe-captionstyle=font-weight:bold;}}',
                                      '{{#invoke:Infobox mapframe|auto|onByDefault=yes'
                                      ..'|id=Q100|mapframe-caption=Boston|mapframe-captionstyle=font-weight:bold;}}'
                                      ..'<div class="infobox-caption" style="font-weight:bold;">'
                                      ..'{{#invoke:Infobox mapframe|autocaption|onByDefault=yes'
                                      ..'|id=Q100|mapframe-caption=Boston|mapframe-captionstyle=font-weight:bold;}}'
                                      ..'</div>',{stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe|autoWithCaption|onByDefault=no|id=Q100|mapframe-caption=Boston}}','',
                                      {stripmarker=1})
end

function p:test_autoWithCaption_sandbox()
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe/sandbox|autoWithCaption|onByDefault=yes|mapframe-caption=Boston}}','',
                                      {stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe/sandbox|autoWithCaption|onByDefault=yes|id=Q100}}',
                                      '{{#invoke:Infobox mapframe/sandbox|auto|onByDefault=yes|id=Q100}}'
                                      ..'<div class="infobox-caption">'
                                      ..'{{#invoke:Infobox mapframe/sandbox|autocaption|onByDefault=yes|id=Q100}}'
                                      ..'</div>',{stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe/sandbox|autoWithCaption|onByDefault=yes|id=Q100|mapframe-caption=Boston}}',
                                      '{{#invoke:Infobox mapframe/sandbox|auto|onByDefault=yes|id=Q100|mapframe-caption=Boston}}'
                                      ..'<div class="infobox-caption">'
                                      ..'{{#invoke:Infobox mapframe/sandbox|autocaption|onByDefault=yes|id=Q100|mapframe-caption=Boston}}'
                                      ..'</div>',{stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe/sandbox|autoWithCaption|onByDefault=yes'
                                      ..'|id=Q100|mapframe-caption=Boston|captionstyle=font-weight:bold;}}',
                                      '{{#invoke:Infobox mapframe/sandbox|auto|onByDefault=yes'
                                      ..'|id=Q100|mapframe-caption=Boston|captionstyle=font-weight:bold;}}'
                                      ..'<div class="infobox-caption" style="font-weight:bold;">'
                                      ..'{{#invoke:Infobox mapframe/sandbox|autocaption|onByDefault=yes'
                                      ..'|id=Q100|mapframe-caption=Boston|captionstyle=font-weight:bold;}}'
                                      ..'</div>',{stripmarker=1})
    self:preprocess_equals_preprocess('{{#invoke:Infobox mapframe/sandbox|autoWithCaption|onByDefault=no|id=Q100|mapframe-caption=Boston}}','',
                                      {stripmarker=1})
end

return p