Skip to content

Commit 0892796

Browse files
Update to Page Forms 5.3.4 (#92)
* fixed title lookup for combobox fields (which changed from select2 to OOUI) * fixed parsing API response * fixed population of elements depending on SFS elements * fixed deprecations * updated CI targets * added some node-qunit tests * deleted obsolete files
1 parent 4b29a6b commit 0892796

29 files changed

+7843
-809
lines changed

.eslintrc.json

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"root": true,
3+
"parserOptions": {
4+
"ecmaVersion": 6
5+
},
6+
"extends": [
7+
"wikimedia/client-es5",
8+
"wikimedia/jquery",
9+
"wikimedia/mediawiki"
10+
],
11+
"env": {
12+
"commonjs": true
13+
},
14+
"rules": {
15+
"camelcase": "off",
16+
"comma-dangle": "off",
17+
"comma-spacing": "off",
18+
"computed-property-spacing": "off",
19+
"curly": "off",
20+
"dot-notation": "off",
21+
"eqeqeq": "off",
22+
"func-call-spacing": "off",
23+
"indent": "off",
24+
"key-spacing": "off",
25+
"keyword-spacing": "off",
26+
"max-len": "off",
27+
"max-statements-per-line": "off",
28+
"new-cap": "off",
29+
"no-alert": "off",
30+
"no-extra-semi": "off",
31+
"no-implicit-coercion": "off",
32+
"no-jquery/no-animate-toggle": "off",
33+
"no-jquery/no-bind": "off",
34+
"no-jquery/no-browser": "off",
35+
"no-jquery/no-each-util": "off",
36+
"no-jquery/no-event-shorthand": "off",
37+
"no-jquery/no-fade": "off",
38+
"no-jquery/no-global-selector": "off",
39+
"no-jquery/no-grep": "off",
40+
"no-jquery/no-in-array": "off",
41+
"no-jquery/no-is-array": "off",
42+
"no-jquery/no-is-numeric": "off",
43+
"no-jquery/no-map-util": "off",
44+
"no-jquery/no-parse-html-literal": "off",
45+
"no-jquery/no-parse-json": "off",
46+
"no-jquery/no-ready-shorthand": "off",
47+
"no-jquery/no-size": "off",
48+
"no-jquery/no-slide": "off",
49+
"no-jquery/no-trim": "off",
50+
"no-jquery/no-unbind": "off",
51+
"no-jquery/no-unique": "off",
52+
"no-mixed-spaces-and-tabs": "off",
53+
"no-multiple-empty-lines": "off",
54+
"no-multi-spaces": "off",
55+
"no-octal-escape": "off",
56+
"no-prototype-builtins": "off",
57+
"no-redeclare": "off",
58+
"no-restricted-syntax": "off",
59+
"no-shadow-restricted-names": "off",
60+
"no-tabs": "off",
61+
"no-throw-literal": "off",
62+
"no-undef": "off",
63+
"no-underscore-dangle": "off",
64+
"no-unneeded-ternary": "off",
65+
"no-unreachable": "off",
66+
"no-unused-vars": "off",
67+
"no-use-before-define": "off",
68+
"no-useless-concat": "off",
69+
"no-useless-escape": "off",
70+
"no-whitespace-before-property": "off",
71+
"object-curly-spacing": "off",
72+
"operator-linebreak": "off",
73+
"quote-props": "off",
74+
"quotes": "off",
75+
"semi": "off",
76+
"semi-spacing": "off",
77+
"space-before-blocks": "off",
78+
"space-before-function-paren": "off",
79+
"spaced-comment": "off",
80+
"space-infix-ops": "off",
81+
"space-in-parens": "off",
82+
"space-unary-ops": "off",
83+
"valid-jsdoc": "off",
84+
"wrap-iife": "off",
85+
"yoda": "off",
86+
"no-jquery/no-class-state": "warn",
87+
"no-jquery/no-sizzle": "warn",
88+
"no-jquery/variable-pattern": "warn",
89+
"no-shadow": "warn",
90+
"no-unreachable-loop": "warn",
91+
"mediawiki/msg-doc": "warn",
92+
"compat/compat": "warn",
93+
"block-scoped-var": "warn"
94+
}
95+
}

.github/workflows/main.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ jobs:
2020
page_forms_version: 5.3.4
2121
coverage: true
2222
experimental: true
23+
- mediawiki_version: '1.35'
24+
semantic_mediawiki_version: dev-master
25+
page_forms_version: master
26+
coverage: false
27+
experimental: true
28+
- mediawiki_version: '1.36'
29+
semantic_mediawiki_version: dev-master
30+
page_forms_version: master
31+
coverage: false
32+
experimental: true
33+
- mediawiki_version: '1.37'
34+
semantic_mediawiki_version: dev-master
35+
page_forms_version: master
36+
coverage: false
37+
experimental: true
2338

2439
container:
2540
image: gesinn/docker-mediawiki:${{ matrix.mediawiki_version }}
@@ -79,17 +94,38 @@ jobs:
7994
tail -n5 ${{ env.MW_INST_PATH }}/LocalSettings.php
8095
php ${{ env.MW_INST_PATH }}/maintenance/update.php --quick
8196
82-
- name: Run Tests
97+
- name: Run PHPUnit Tests
8398
run: >
8499
php ${{ env.MW_INST_PATH }}/tests/phpunit/phpunit.php
85100
--configuration ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}
86101
--testdox
87102
if: matrix.coverage == false
88103

89-
- name: Run Tests With Coverage
104+
- name: Run PHPUnit Tests With Coverage
90105
run: >
91106
php ${{ env.MW_INST_PATH }}/tests/phpunit/phpunit.php
92107
--configuration ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}
93108
--testdox
94109
--coverage-clover ${{ env.MW_INST_PATH }}/docs/coverage.xml
95110
if: matrix.coverage == true
111+
112+
- name: Install Node Modules
113+
run: >
114+
cd ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }} && npm ci
115+
116+
- name: Run Node.js Tests
117+
run: >
118+
cd ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }} && npm test
119+
if: matrix.coverage == false
120+
121+
- name: Run Node.js Tests With Coverage
122+
run: >
123+
cd ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }} && npm run test-coverage
124+
if: matrix.coverage == true
125+
126+
- name: Upload code coverage
127+
uses: codecov/codecov-action@v2
128+
with:
129+
token: ${{ secrets.CODECOV_TOKEN }}
130+
files: ${{ env.MW_INST_PATH }}/docs/coverage.xml,${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}/coverage/clover.xml
131+
if: matrix.coverage == true

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ composer.lock
1010
!.*
1111
.idea/
1212
.phpunit.result.cache
13+
14+
node_modules/
15+
.eslintcache
16+
.nyc_output
17+
coverage

.scrutinizer.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
# Semantic Forms Select
22

33
[![CI](https://github.com/SemanticMediaWiki/SemanticFormsSelect/actions/workflows/main.yml/badge.svg)](https://github.com/SemanticMediaWiki/SemanticFormsSelect/actions/workflows/main.yml)
4-
[![Code Coverage](https://scrutinizer-ci.com/g/SemanticMediaWiki/SemanticFormsSelect/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/SemanticMediaWiki/SemanticFormsSelect/?branch=master)
5-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/SemanticMediaWiki/SemanticFormsSelect/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/SemanticMediaWiki/SemanticFormsSelect/?branch=master)
4+
[![codecov](https://codecov.io/gh/SemanticMediaWiki/SemanticFormsSelect/branch/master/graph/badge.svg?token=sSjXlzUDXI)](https://codecov.io/gh/SemanticMediaWiki/SemanticFormsSelect)
65
[![Latest Stable Version](https://poser.pugx.org/mediawiki/semantic-forms-select/version.png)](https://packagist.org/packages/mediawiki/semantic-forms-select)
76
[![Packagist download count](https://poser.pugx.org/mediawiki/semantic-forms-select/d/total.png)](https://packagist.org/packages/mediawiki/semantic-forms-select)
87

98
Semantic Forms Select (a.k.a. SFS) can generate a select form element with values retrieved from a `#ask` query or a parser function.
109

1110
## Requirements
1211

13-
- PHP 5.6 or later
14-
- MediaWiki 1.27 or later
15-
- [Semantic MediaWiki][smw] 2.5 or later
16-
- [Page Forms][pf] 4.0.2 or later
12+
- PHP 7.3 or later
13+
- MediaWiki 1.35 or later
14+
- [Semantic MediaWiki][smw] 3.0.0 or later
15+
- [Page Forms][pf] 5.3.0 or later
1716

1817
## Installation
1918

@@ -38,15 +37,15 @@ If you do not have a "composer.local.json" file yet, create one and add the foll
3837
```
3938
{
4039
"require": {
41-
"mediawiki/semantic-forms-select": "~3.0"
40+
"mediawiki/semantic-forms-select": "~4.0"
4241
}
4342
}
4443
```
4544

4645
If you already have a "composer.local.json" file add the following line to the end of the "require"
4746
section in your file:
4847

49-
"mediawiki/semantic-forms-select": "~3.0"
48+
"mediawiki/semantic-forms-select": "~4.0"
5049

5150
Remember to add a comma to the end of the preceding line in this section.
5251

@@ -87,15 +86,14 @@ Original code from https://code.google.com/p/semanticformsselect/downloads/list
8786

8887
## Tests
8988

90-
This extension provides unit and integration tests that are run by a [continues integration platform][travis]
91-
but can also be executed using `composer phpunit` from the extension base directory.
89+
This extension provides PHP and JavaScript tests that are run by continues integration platform
90+
but can also be executed using `composer phpunit` and `npm ci && npm test` from the extension base directory.
9291

9392
## License
9493

9594
[GNU General Public License, version 2 or later][gpl-licence].
9695

9796
[gpl-licence]: https://www.gnu.org/copyleft/gpl.html
9897
[smw]: https://github.com/SemanticMediaWiki/SemanticMediaWiki
99-
[travis]: https://travis-ci.org/SemanticMediaWiki/SemanticFormsSelect
10098
[pf]: https://www.mediawiki.org/wiki/Extension:Page_Forms
10199
[composer]: https://getcomposer.org/

RELEASE-NOTES.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
This file contains the RELEASE-NOTES of the Semantic Forms Select (a.k.a. SFS) extension.
22

3-
### 3.1.0
4-
5-
This is not a realease yet.
3+
### 4.0.0-beta
4+
5+
* Dropped support for MediaWiki 1.34 and lower
6+
* Dropped support for PHP 7.2 and lower
7+
* Dropped support for Page Forms 5.3 and lower
8+
* Added support for Page Forms 5.3 OOUI input types
9+
* Added support for Semantic MediaWiki 4.x
10+
* Added QUnit tests (node-qunit)
11+
* Fixed PHPUnit tests
612

713
### 3.0.0
814

SemanticFormsSelect.hooks.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class Hooks {
1717
* @return bool
1818
*/
1919
public static function onSemanticFormsSelectSetup ( & $parser ) {
20-
2120
if ( !defined( 'PF_VERSION' ) ) {
2221
die( '<b>Error:</b><a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">Semantic Forms Select</a> requires the <a href="https://www.mediawiki.org/wiki/Extension:PageForms">Page Forms</a> extension. Please install and activate this extension first.' );
2322
}
@@ -28,11 +27,28 @@ public static function onSemanticFormsSelectSetup ( & $parser ) {
2827

2928
return true;
3029
}
31-
32-
public static function onRegistration() {
3330

31+
public static function onRegistration() {
3432
if ( isset( $GLOBALS['wgAPIModules'] ) ) {
3533
$GLOBALS['wgAPIModules']['sformsselect'] = \SFS\ApiSemanticFormsSelect::class;
3634
}
3735
}
36+
37+
/**
38+
* Hook: ResourceLoaderTestModules
39+
* @param array &$modules
40+
*/
41+
public static function onResourceLoaderTestModules( array &$modules ) {
42+
$modules['qunit']['ext.sfs.unit'] = [
43+
'scripts' => [
44+
'res/sfs.js',
45+
'tests/qunit/unit/sfs.test.js'
46+
],
47+
'dependencies' => [
48+
'ext.pageforms.originalValueLookup'
49+
],
50+
'localBasePath' => __DIR__,
51+
'remoteExtPath' => 'SemanticFormsSelect',
52+
];
53+
}
3854
}

codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fixes:
2+
- "/var/www/html/extensions/SemanticFormsSelect/::"

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@
3737
}
3838
],
3939
"require": {
40-
"php": ">=7.2",
40+
"php": ">=7.3",
4141
"composer/installers": "1.*,>=1.0.1",
42-
"mediawiki/semantic-media-wiki": "~2.5|~3.0|~4.0",
43-
"mediawiki/page-forms": ">=4.0.2"
42+
"mediawiki/semantic-media-wiki": "~3.0|~4.0",
43+
"mediawiki/page-forms": ">=5.3.0"
4444
},
4545
"require-dev": {
4646
"mediawiki/semantic-media-wiki": "@dev"
4747
},
4848
"extra": {
4949
"branch-alias": {
50-
"dev-master": "3.1.x-dev"
50+
"dev-master": "4.0.x-dev"
5151
}
5252
},
5353
"autoload": {

0 commit comments

Comments
 (0)