Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/rgba-regex/test/ drwxrwxr-x | |
| Viewing file: Select action/file-type: var assert = require('assert');
var rgbaRegex = require('..');
var rgbaStrings = [
'rgba(12,34,56, 1)',
'rgba(255, 255, 255, .9)',
'rgba(1, 1,1, 0.2)'
];
var inexactRgbaStrings = [
'rgba(,,,)',
'rGba(12,34,56,1)',
'rgba(12, 34, 200,1) ',
' rgba(12,34,56,1)',
'rgba(1,2,,)'
];
describe('rgba-regex', function() {
describe('exact: true', function() {
it('should return a regex that matches exact rgba strings', function() {
rgbaStrings.forEach(function(rgba) {
assert.ok(rgbaRegex({ exact: true }).test(rgba));
});
});
it('should return a regex that does not match invalid rgba strings', function() {
inexactRgbaStrings.forEach(function(invalidRgba) {
assert.ok(!rgbaRegex({ exact: true }).test(invalidRgba));
});
});
});
describe('g', function() {
it('should match rgba strings', function() {
assert.deepEqual(
rgbaStrings.join('foobar').match(rgbaRegex()),
rgbaStrings
)
});
it('should not match non rgba strings', function() {
assert.deepEqual(
inexactRgbaStrings.join('foobar').match(rgbaRegex()),
['rGba(12,34,56,1)', 'rgba(12, 34, 200,1)', 'rgba(12,34,56,1)']
);
});
});
});
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0373 ]-- |