Skip to content

Commit

Permalink
remove extra semicolon from style + unit tests #937
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Apr 29, 2024
1 parent 425d3b1 commit d2573ae
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -8,7 +8,7 @@
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/jquery.terminal)
![bower](https://img.shields.io/badge/bower-DEV-yellow.svg)
[![Build and test](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/jquery.terminal/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&1b4f43839e9a18890938b506396293ca)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/jquery.terminal/badge.svg?branch=devel&8f2e58e2cbb0889679fb75085e7c7a4b)](https://coveralls.io/github/jcubic/jquery.terminal?branch=devel)
![NPM Downloads](https://img.shields.io/npm/dm/jquery.terminal.svg?style=flat)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/jquery.terminal/badge?style=rounded&n=1)](https://www.jsdelivr.com/package/npm/jquery.terminal)
[![Paid Support](https://img.shields.io/badge/paid-support-354465.svg)](https://support.jcubic.pl/)
Expand Down
11 changes: 11 additions & 0 deletions __tests__/terminal.spec.js
Expand Up @@ -1106,6 +1106,17 @@ describe('Terminal utils', function() {
});
expect(output).toMatchSnapshot();
});
it('should handle images with html entties', () => {
const url = 'https://images.unsplash.com/photo-1564865878688-9a…4NzEyMjB8MA&ixlib=rb-4.0.3&q=80&w=400';
const style = 'border:1px solid red'
const input = `[[@;;;;${url};{"style":"${style}"}]black Android smartphone]`;
const output = $.terminal.format(input, {
allowedAttributes: ['style']
});
const $img = $(output);
expect($img.attr('src')).toEqual(url.replace(/&/g, '&'));
expect($img.attr('style')).toEqual(style);
});
});
describe('$.terminal.strip', function() {
it('should remove formatting', function() {
Expand Down
8 changes: 5 additions & 3 deletions js/jquery.terminal-2.40.6.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Mon, 29 Apr 2024 14:58:28 +0000
* Date: Mon, 29 Apr 2024 15:00:50 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5312,7 +5312,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Mon, 29 Apr 2024 14:58:28 +0000',
date: 'Mon, 29 Apr 2024 15:00:50 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -6857,7 +6857,9 @@
var value = escape_html_attr(attrs[name]);
if (name === 'style') {
// merge style attr and colors #617
value = value ? style + ';' + value : style;
if (style) {
value = value ? style + ';' + value : style;
}
style_attrs = true;
}
return name + '="' + value + '"';
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.40.6.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion js/jquery.terminal-src.js
Expand Up @@ -6857,7 +6857,9 @@
var value = escape_html_attr(attrs[name]);
if (name === 'style') {
// merge style attr and colors #617
value = value ? style + ';' + value : style;
if (style) {
value = value ? style + ';' + value : style;
}
style_attrs = true;
}
return name + '="' + value + '"';
Expand Down
8 changes: 5 additions & 3 deletions js/jquery.terminal.js
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Mon, 29 Apr 2024 14:58:28 +0000
* Date: Mon, 29 Apr 2024 15:00:50 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5312,7 +5312,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Mon, 29 Apr 2024 14:58:28 +0000',
date: 'Mon, 29 Apr 2024 15:00:50 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -6857,7 +6857,9 @@
var value = escape_html_attr(attrs[name]);
if (name === 'style') {
// merge style attr and colors #617
value = value ? style + ';' + value : style;
if (style) {
value = value ? style + ';' + value : style;
}
style_attrs = true;
}
return name + '="' + value + '"';
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/jquery.terminal.min.js.map

Large diffs are not rendered by default.

0 comments on commit d2573ae

Please sign in to comment.