Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:Deprecated archive/testcases

From Wikipedia, the free encyclopedia
local p = require('Module:UnitTests')
local module = require('Module:Deprecated archive')

local marker = '<sup>&#91;[[WP:ATODAY|link removed]]&#93;</sup>'

local function expected_label(label)
	return '<span style="text-decoration: underline dashed #ccc;">' ..
		label ..
		'</span>' .. marker
end

local function without_tracking_category(text)
	return (text:gsub('%[%[Category:[^%]]+%]%]$', ''))
end

function p:test_html_entities_render_normally()
	local nbsp = mw.ustring.char(160)

	self:equals(
		'&nbsp; decodes to a non-breaking space',
		without_tracking_category(module._main({
			url = 'https://blacklisted.example.com/20120721063948/http://usps.whitepages.com/service/post_office/67234?p=1&s=NY&service_name=post_office&z=10001',
			title = 'Post Office Location&nbsp;– James A. Farley',
		})),
		expected_label('Post Office Location' .. nbsp .. '– James A. Farley'),
		{nowiki = true}
	)

	self:equals(
		'&nbsp; inside a title decodes to a non-breaking space',
		without_tracking_category(module._main({
			url = 'https://blacklisted.example.com/20110310083111/http://www3.interscience.wiley.com/journal/122575093/abstract',
			title = 'Inkjet Printing&nbsp;– Process and Its Applications',
		})),
		expected_label('Inkjet Printing' .. nbsp .. '– Process and Its Applications'),
		{nowiki = true}
	)

	self:equals(
		'&ndash; decodes to an en dash',
		without_tracking_category(module._main({
			url = 'https://blacklisted.example.com/20150420042022/http://factfinder.census.gov/bkmk/table/1.0/en/DEC/10_SF1/GCTPH1.CY10/0500000US34037',
			title = 'GCT-PH1: Population, Housing Units, Area, and Density: 2010 - County &ndash; County Subdivision and Place from the 2010 Census Summary File 1 for Burlington County, New Jersey',
		})),
		expected_label('GCT-PH1: Population, Housing Units, Area, and Density: 2010 - County – County Subdivision and Place from the 2010 Census Summary File 1 for Burlington County, New Jersey'),
		{nowiki = true}
	)
end

return p