Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 27, 2025. It is now read-only.
/html-mockerPublic archive

Script to mock dynamic data in HTML for automatic responsiveness testing

NotificationsYou must be signed in to change notification settings

ClearTax/html-mocker

Repository files navigation

This is an idea for mocking HTML data that lets you test whether your layout breaks on any screen size for anyunexpected dynamic data.

This script scans the document for class names with a specific pattern and periodically randomizes the contentof those elements while meeting the constraints specified in the class name. This can let you quickly testwhether your layout breaks for any dynamic content that you may not have thought about. This should ideally be usedwith a responsive design testing tool such as DevTools or Sizzy/Bizzy.

For eg, if your HTML is this:

<h1>article headline</h1>

Then, this script will find this tag, and periodically replace the innerText of h1 with random strings which areanywhere between the minimum length 30 and maximum length 90. Similiarily, constraints on image sizes,video sizes, # of children elements in a list etc. For a list, mock children elements will be generated

Some examples of the constraints are:

  • size-30__50 (from 30 to 50 chars)
  • size-__50 (up to 50 chars)
  • size-50__ (from 50 to anysize)
  • size-45 (exactly 45 chars)
  • size-"50x50__500x500" (50px x 50px to 600px x 600px)
  • size-3__7 (list size from minimum 3 to maximum 7)

Ideas for more constraints:

  • Allowed characters (such as whitespace or emojis)
  • Image's aspect ratio
  • Video sizes, formats

[8]ページ先頭

©2009-2025 Movatter.jp