Skip to content

Commit

Permalink
Fix CSP issues in misc tests (DevExpress#24509) (DevExpress#24615)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lykoi18 committed May 15, 2023
1 parent d365ed9 commit 4373ea2
Show file tree
Hide file tree
Showing 16 changed files with 336 additions and 187 deletions.
70 changes: 35 additions & 35 deletions .github/workflows/qunit_tests-additional-renovation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,41 @@ jobs:
timeout-minutes: 15

steps:
- name: Get sources
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '15'

- name: Restore npm cache
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-modules

- name: Run npm install
run: npm install --no-audit --no-fund

- name: Build
env:
DEVEXTREME_TEST_CI: "true"
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
run: npm run build:dev

- name: Zip artifacts
run: |
7z a -tzip -mx3 -mmt2 artifacts.zip artifacts scss/bundles testing/tests/Renovation/widgets.json
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: devextreme-artifacts
path: artifacts.zip
retention-days: 1
- name: Get sources
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '15'

- name: Restore npm cache
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-modules

- name: Run npm install
run: npm install --no-audit --no-fund

- name: Build
env:
DEVEXTREME_TEST_CI: "true"
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
run: npm run build:dev

- name: Zip artifacts
run: |
7z a -tzip -mx3 -mmt2 artifacts.zip artifacts scss/bundles testing/tests/Renovation/widgets.json
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: devextreme-artifacts
path: artifacts.zip
retention-days: 1

qunit-tests-timezones:
needs: build
Expand Down
94 changes: 59 additions & 35 deletions testing/tests/DevExpress.angular/widgets.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,19 @@ QUnit.test('dxPopup', function(assert) {
originalPositionSetup($content, position);
};

const $markup = $('\
<div dx-popup=\'popupOptions\'>\
<div data-options=\'dxTemplate: { name: "custom" }\' style=\'line-height: 18px\'>\
{{VeryVeryVeryLongField.value1}}\
{{VeryVeryVeryLongField.value2}}\
</div>\
</div>\
');
const $markup = $(`
<style nonce="qunit-test">
#popup {
line-height: 18px;
}
</style>
<div dx-popup="popupOptions">
<div id="popup" data-options="dxTemplate: { name: 'custom' }">
{{VeryVeryVeryLongField.value1}}
{{VeryVeryVeryLongField.value2}}
</div>
</div>
`);

const controller = function($scope) {
$scope.VeryVeryVeryLongField = {
Expand Down Expand Up @@ -118,14 +123,19 @@ QUnit.test('dxPopup', function(assert) {
});

QUnit.test('dxPopover', function(assert) {
const $markup = $('\
<a id="link1">testLink</a>\
<div id="popover" dx-popover=\'popoverOptions\'>\
<div data-options=\'dxTemplate: { name: "content" }\' style=\'line-height: 18px\'>\
{{popoverContent}} {{popoverContent}}\
</div>\
</div>\
');
const $markup = $(`
<style nonce="qunit-test">
#popover-content {
line-height: 18px;
}
</style>
<a id="link1">testLink</a>
<div id="popover" dx-popover="popoverOptions">
<div id="popover-content" data-options="dxTemplate: { name: 'content' }">
{{popoverContent}} {{popoverContent}}
</div>
</div>
`);

const controller = function($scope) {
$scope.popoverOptions = {
Expand Down Expand Up @@ -702,11 +712,16 @@ QUnit.test('Component can change itself options on init (T446364)', function(ass
});

QUnit.test('The hamburger button should be visible on small screen (T377800)', function(assert) {
const $markup = $('\
<div style=\'width: 100px\'>\
<div dx-menu=\'menu\'></div>\
</div>'
);
const $markup = $(`
<style nonce="qunit-test">
#markup {
width: 100px;
}
</style>
<div id="markup">
<div dx-menu='menu'></div>
</div>
`);

const controller = function($scope) {
$scope.menu = {
Expand Down Expand Up @@ -803,13 +818,18 @@ QUnit.test('item height is correct in animation config (T520346)', function(asse

const originalAnimate = fx.animate;

const $markup = $(
'<div dx-accordion="accordionOptions" dx-item-alias="veryVeryVeryLongAlias">\
<div data-options="dxTemplate : { name: \'item\' } " style=\'line-height: 18px\'>\
{{veryVeryVeryLongAlias.Value}} {{veryVeryVeryLongAlias.Value}}\
</div>\
</div>'
);
const $markup = $(`
<style nonce="qunit-test">
#accordion-data {
line-height: 18px;
}
</style>
<div dx-accordion="accordionOptions" dx-item-alias="veryVeryVeryLongAlias">
<div id="accordion-data" data-options="dxTemplate : { name: 'item' }">
{{veryVeryVeryLongAlias.Value}} {{veryVeryVeryLongAlias.Value}}
</div>
</div>
`);

const controller = function($scope) {
$scope.accordionOptions = {
Expand Down Expand Up @@ -843,14 +863,18 @@ QUnit.test('item height is correct in animation config (T520346)', function(asse
QUnit.test('title height is correct if the title is customized using ng-class (T444379)', function(assert) {
this.clock = sinon.useFakeTimers();

const $markup = $(
'<style>.test-class { height: 100px; }</style>\
<div dx-accordion="accordionOptions" dx-item-alias="item">\
<div data-options="dxTemplate : { name: \'title\' } ">\
<div ng-class="getClass()">{{item.Value}}</div>\
const $markup = $(`
<style nonce="qunit-test">
.test-class {
height: 100px;
}
</style>
<div dx-accordion="accordionOptions" dx-item-alias="item">
<div data-options="dxTemplate : { name: 'title' } ">
<div ng-class="getClass()">{{item.Value}}</div>
</div>\
</div>'
);
</div>
`);

const controller = function($scope) {
$scope.accordionOptions = {
Expand Down
76 changes: 50 additions & 26 deletions testing/tests/DevExpress.animation/fx.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,56 @@ const positionUtils = require('animation/position');

QUnit.testStart(function() {
const markup =
'<style>\
.my-animation {\
-moz-transition-property: all;\
-o-transition-property: all;\
-webkit-transition-property: all;\
transition-property: all;\
-moz-transform: translate3d(0px,0px,0px);\
-o-transform: translate3d(0px,0px,0px);\
-webkit-transform: translate3d(0px,0px,0px);\
transform: translate3d(0px,0px,0px);\
}\
.my-animation.my-animation-active {\
-moz-transform: translate3d(1000px,0px,0px);\
-o-transform: translate3d(1000px,0px,0px);\
-webkit-transform: translate3d(1000px,0px,0px);\
transform: translate3d(1000px,0px,0px);\
}\
</style>\
\
<div id="qunit-fixture" class="qunit-fixture-visible">\
<div id="container" style="position: relative;">\
<div id="test" style="position: absolute; top:0; left:0; width: 50px; height: 50px; background: yellow;"></div>\
<div id="transitionPropTest" style="position: absolute; top:0; left:0; width: 50px; height: 50px; background: red;"></div>\
<div id="staticTest" style="width: 50px; height: 50px; background: green;"></div>\
</div>\
</div>';
`<style nonce="qunit-test">
.my-animation {
-moz-transition-property: all;
-o-transition-property: all;
-webkit-transition-property: all;
transition-property: all;
-moz-transform: translate3d(0px,0px,0px);
-o-transform: translate3d(0px,0px,0px);
-webkit-transform: translate3d(0px,0px,0px);
transform: translate3d(0px,0px,0px);
}
.my-animation.my-animation-active {
-moz-transform: translate3d(1000px,0px,0px);
-o-transform: translate3d(1000px,0px,0px);
-webkit-transform: translate3d(1000px,0px,0px);
transform: translate3d(1000px,0px,0px);
}
#container {
position: relative;
}
#test {
position: absolute;
top:0;
left:0;
width: 50px;
height: 50px;
background: yellow;
}
#transitionPropTest {
position: absolute;
top:0;
left:0;
width: 50px;
height: 50px;
background: red;
}
#staticTest {
width: 50px;
height: 50px;
background: green;
}
</style>
<div id="qunit-fixture" class="qunit-fixture-visible">
<div id="container">
<div id="test"></div>
<div id="transitionPropTest"></div>
<div id="staticTest"></div>
</div>
</div>`;

$('#qunit-fixture').html(markup);
});
Expand Down
4 changes: 2 additions & 2 deletions testing/tests/DevExpress.aspnet/aspnet_bundled.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ SystemJS.config({

define(function(require) {
window.DevExpress_ui_widget_errors = require('ui/widget/ui.errors');
window.ajaxMock = require('/testing/helpers/ajaxMock.js');
window.ajaxMock = require('../../helpers/ajaxMock.js');
require('bundles/dx.web.js');
require('aspnet.js');
require('/testing/tests/DevExpress.aspnet/aspnet.tests.js');
require('./aspnet.tests.js');
});
2 changes: 2 additions & 0 deletions testing/tests/DevExpress.core/devices.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const userAgents = {
win_phone_10: 'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; NOKIA; Lumia 920) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.0',
};

themes.setDefaultTimeout(0);

QUnit.module('devices', {
beforeEach: function() {
this._savedDevice = devices.current();
Expand Down

0 comments on commit 4373ea2

Please sign in to comment.