Neutral sample account names in tests, check scripts and the site's demo UI

The framework moves to 0e344ee.
This commit is contained in:
CRTkafa 2026-10-19 01:02:34 +07:00
parent 83f8c363b4
commit 4c6817ecb5
42 changed files with 136 additions and 136 deletions

View file

@ -287,7 +287,7 @@ class El {
const EDITOR = { 'data-testid': 'tweetTextarea_0', role: 'textbox', contenteditable: 'true' };
/** X's page with the account button and one composer (editor, toolbar with Post). */
function composerPage(handle = 'fishies') {
function composerPage(handle = 'sample') {
const block = new El('div', { 'data-block': 'true' });
const editor = new El('div', EDITOR, new El('div', { 'data-contents': 'true' }, block));
const postButton = new El('button', { 'data-testid': 'tweetButtonInline' }, 'Post');
@ -366,16 +366,16 @@ test('length meter: counts the way X counts', () => {
});
test('"Posting as": one colour per account, whatever the case of the handle', () => {
assert.equal(accountHue('Fishies'), accountHue('fishies'));
assert.notEqual(accountHue('fishies'), accountHue('someone'));
for (const handle of ['a', 'fishies', 'someone_else', 'A_15_char_handl']) {
assert.equal(accountHue('Sample'), accountHue('sample'));
assert.notEqual(accountHue('sample'), accountHue('someone'));
for (const handle of ['a', 'sample', 'someone_else', 'A_15_char_handl']) {
const hue = accountHue(handle);
assert.ok(Number.isInteger(hue) && hue >= 0 && hue < 360, handle);
}
});
test('"Posting as" and the length meter: one line above the toolbar, kept current, gone without a trace', () => {
const page = composerPage('fishies');
const page = composerPage('sample');
const before = page.body.html();
const env = composeEnv(page);
const idle = env.listeners();
@ -385,10 +385,10 @@ test('"Posting as" and the length meter: one line above the toolbar, kept curren
const bar = page.toolbar.previousElementSibling!;
assert.ok(bar.hasAttribute('data-bt-compose-bar'), 'the line is right above X\'s toolbar');
const chip = bar.querySelector('[data-bt-compose-chip]')!;
assert.equal(chip.textContent, 'Posting as @fishies');
assert.equal(chip.getAttribute('data-bt-compose-chip'), 'fishies');
assert.equal(chip.style.props['--bt-compose-hue'], String(accountHue('fishies')));
assert.match(chip.title, /@fishies/);
assert.equal(chip.textContent, 'Posting as @sample');
assert.equal(chip.getAttribute('data-bt-compose-chip'), 'sample');
assert.equal(chip.style.props['--bt-compose-hue'], String(accountHue('sample')));
assert.match(chip.title, /@sample/);
assert.equal(bar.querySelector('[data-bt-compose-meter]'), null, 'an empty composer has nothing to measure');
// Typing: the meter follows, in the same line.
page.block.textContent = 'hello https://example.com/a/long/link';
@ -442,7 +442,7 @@ test('"Posting as" and the length meter: one line above the toolbar, kept curren
env.registry.setFlags(only({}));
second.remove();
page.block.textContent = '';
page.avatar.setAttribute('data-testid', 'UserAvatar-Container-fishies');
page.avatar.setAttribute('data-testid', 'UserAvatar-Container-sample');
assert.equal(page.body.html(), before);
assert.deepEqual(env.live(), []);
assert.equal(env.listeners(), idle);