Skip to content

Commit

Permalink
Moves soundstage-player to elements/
Browse files Browse the repository at this point in the history
  • Loading branch information
stephband committed Sep 26, 2023
1 parent ba24ed6 commit 8ccad91
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 99 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions elements/soundstage-player.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export { default } from './soundstage-player/module.js';
24 changes: 12 additions & 12 deletions player/module.js → elements/soundstage-player/module.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

import Stream, { frames } from '../../fn/modules/stream.js';
import { formatTime } from '../../fn/modules/time.js';
import observe from '../../fn/observer/observe.js';
import Observer from '../../fn/observer/observer.js';
import delegate from '../../dom/modules/delegate.js';
import createBoolean from '../../dom/modules/element/create-boolean.js';
import createTokenList from '../../dom/modules/element/create-token-list.js';
import element, { getInternals } from '../../dom/modules/element.js';
import events from '../../dom/modules/events.js';
import request from '../../dom/modules/request.js';
import { getSequenceDuration } from '../modules/sequencer/get-duration.js'
import Soundstage from '../modules/soundstage.js';
import Stream, { frames } from '../../../fn/modules/stream.js';
import { formatTime } from '../../../fn/modules/time.js';
import observe from '../../../fn/observer/observe.js';
import Observer from '../../../fn/observer/observer.js';
import delegate from '../../../dom/modules/delegate.js';
import createBoolean from '../../../dom/modules/element/create-boolean.js';
import createTokenList from '../../../dom/modules/element/create-token-list.js';
import element, { getInternals } from '../../../dom/modules/element.js';
import events from '../../../dom/modules/events.js';
import request from '../../../dom/modules/request.js';
import { getSequenceDuration } from '../../modules/sequencer/get-duration.js'
import Soundstage from '../../modules/soundstage.js';


export default element('soundstage-player', {
Expand Down
84 changes: 0 additions & 84 deletions elements/sparky/param.js

This file was deleted.

6 changes: 3 additions & 3 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta charset="utf-8" />
<title>Tests</title>

<link rel="stylesheet" href="./tests/tests.css" />
<link rel="stylesheet" href="./test/tests.css" />

<!-- These elements are picked up by Selenium in Github Actions -->
<pre class="console-pre" id="console"></pre>
Expand All @@ -18,7 +18,7 @@
</script>

<script type="module">
import { pass, fail } from './tests/tests.js';
import { pass, fail } from './test/tests.js';
import { done } from '../fn/modules/test.js';

// Import test files here
Expand Down Expand Up @@ -52,7 +52,7 @@
// Soundstage
//import './test/soundstage-test.js';

import SoundstagePlayer from './player/module.js';
import SoundstagePlayer from './elements/soundstage-player.js';

// Report results
done((totals) => (totals.fail > 0 ? fail() : pass()));
Expand Down
28 changes: 28 additions & 0 deletions test/tests.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
body {
padding: 0 0 2.5rem 0;
}

.console-pre {
padding: 0 1.25rem 0 1.25rem;
border-left: 2px solid #dddddd;
}

.result-pre {
position: fixed;
bottom: 0;
left: 0;
right: 0;
margin: 0;
padding: 1.25rem;
box-shadow: 0 0 20px rgba(10, 0, 20, 0.125)
}

.pass-result-pre {
color: black;
background-color: greenyellow;
}

.fail-result-pre {
color: white;
background-color: orangered;
}
53 changes: 53 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

// Console

const consolePre = document.getElementById('console');
const log = window.console.log;
const trace = window.console.trace;

let n = 0;

function stripCSS(output, string) {
// If this is a CSS string, ignore
if (n) {
--n;
return output;
}

// Count CSS strings that will appear as next arguments
const text = string
.replace(/%c/g, () => (++n, ''))
.replace(/%s/, '');

output.push(text);
return output;
}
/*
window.console.log = function() {
log.apply(this, arguments);
const strings = Array.from(arguments).reduce(stripCSS, []);
consolePre.append(strings.join('') + '\n');
};
window.console.trace = function() {
trace.apply(this, arguments);
const strings = Array.from(arguments).reduce(stripCSS, []);
consolePre.append(strings.join('') + '\n');
};
*/

// Result

const resultPre = document.getElementById('result');

export function fail(message) {
resultPre.classList.add('fail-result-pre');
resultPre.innerHTML = 'FAIL' + (message ? '\n\n' + message : '');
resultPre.hidden = false;
}

export function pass() {
resultPre.classList.add('pass-result-pre');
resultPre.innerHTML = 'PASS';
resultPre.hidden = false;
}

0 comments on commit 8ccad91

Please sign in to comment.