deckar01-task_list 2.3.2 → 3.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +22 -0
- data/README.md +2 -4
- data/bower.json +2 -3
- data/build.mjs +26 -0
- data/lib/task_list/filter.rb +22 -53
- data/lib/task_list/version.rb +1 -1
- data/package-lock.json +5042 -0
- data/package.json +19 -24
- data/script/bootstrap +8 -1
- data/script/cibuild +1 -1
- data/task_list.gemspec +7 -0
- data/test/task_list/filter_test.rb +18 -0
- data/test/unit/test_events.coffee +38 -60
- data/test/unit/test_updates.coffee +432 -381
- data/web-test-runner.config.mjs +5 -0
- metadata +19 -15
- data/.travis.yml +0 -16
- data/test/unit/config.js +0 -87
- data/webpack.config.js +0 -19
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "deckar01-task_list",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.0",
|
4
4
|
"description": "Markdown TaskList components",
|
5
5
|
"main": "dist/task_list.js",
|
6
6
|
"directories": {
|
@@ -11,16 +11,16 @@
|
|
11
11
|
],
|
12
12
|
"scripts": {
|
13
13
|
"test": "script/cibuild",
|
14
|
-
"
|
14
|
+
"unit": "web-test-runner bin/test/unit/*.js",
|
15
15
|
"lint": "coffeelint app/assets/javascripts/task_list.coffee",
|
16
|
-
"build:css": "
|
17
|
-
"build:js": "
|
16
|
+
"build:css": "sass --no-source-map app/assets/stylesheets/task_list.scss dist/task_list.css",
|
17
|
+
"build:js": "node build.mjs",
|
18
18
|
"build": "npm run build:css && npm run build:js",
|
19
|
-
"
|
19
|
+
"prepare": "npm run build"
|
20
20
|
},
|
21
21
|
"repository": {
|
22
22
|
"type": "git",
|
23
|
-
"url": "git+https://
|
23
|
+
"url": "git+https://gitlab.com/deckar01/task_list.git"
|
24
24
|
},
|
25
25
|
"keywords": [
|
26
26
|
"task",
|
@@ -32,24 +32,19 @@
|
|
32
32
|
"author": "Jared Deckard <jared.deckard@gmail.com>",
|
33
33
|
"license": "MIT",
|
34
34
|
"bugs": {
|
35
|
-
"url": "https://
|
35
|
+
"url": "https://gitlab.com/deckar01/task_list/issues"
|
36
36
|
},
|
37
|
-
"homepage": "https://
|
37
|
+
"homepage": "https://gitlab.com/deckar01/task_list#task-lists",
|
38
38
|
"devDependencies": {
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
|
50
|
-
"qunit": "^2.9.3",
|
51
|
-
"webpack": "^4.41.2",
|
52
|
-
"webpack-cli": "^3.3.10"
|
53
|
-
},
|
54
|
-
"dependencies": {}
|
39
|
+
"@esm-bundle/chai": "^4.3.4-fix.0",
|
40
|
+
"@web/test-runner": "^0.17.0",
|
41
|
+
"bower": "^1.8.14",
|
42
|
+
"coffeelint": "^2.1.0",
|
43
|
+
"coffeescript": "^2.7.0",
|
44
|
+
"esbuild": "^0.19.0",
|
45
|
+
"esbuild-coffeescript": "^2.2.0",
|
46
|
+
"esbuild-plugin-umd-wrapper": "^1.0.7",
|
47
|
+
"jquery": "^3.7.0",
|
48
|
+
"sass": "^1.65.1"
|
49
|
+
}
|
55
50
|
}
|
data/script/bootstrap
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
set -e 0
|
3
3
|
|
4
|
+
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
5
|
+
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
|
6
|
+
curl -sL https://deb.nodesource.com/setup_19.x | bash -
|
7
|
+
apt-get update -qq && apt-get install -y nodejs google-chrome-stable
|
8
|
+
|
9
|
+
gem install bundler
|
10
|
+
|
4
11
|
if ! bundle check 1>/dev/null 2>&1; then
|
5
12
|
bundle install --no-color --binstubs --path vendor/gems
|
6
13
|
fi
|
7
14
|
|
8
15
|
npm install
|
9
|
-
|
16
|
+
npm exec -- bower install --no-color
|
data/script/cibuild
CHANGED
data/task_list.gemspec
CHANGED
@@ -15,6 +15,13 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
17
|
gem.require_paths = ["lib"]
|
18
|
+
gem.homepage = "https://gitlab.com/deckar01/task_list"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.metadata = {
|
21
|
+
"homepage_uri" => "https://gitlab.com/deckar01/task_list",
|
22
|
+
"bug_tracker_uri" => "https://gitlab.com/deckar01/task_list/-/issues",
|
23
|
+
"source_code_uri" => "https://gitlab.com/deckar01/task_list"
|
24
|
+
}
|
18
25
|
|
19
26
|
gem.required_ruby_version = ">= 2.0.0"
|
20
27
|
|
@@ -113,6 +113,24 @@ class TaskList::FilterTest < Minitest::Test
|
|
113
113
|
assert_equal 2, filter(text)[:output].css('.task-list-item .task-list-item .task-list-item').size
|
114
114
|
end
|
115
115
|
|
116
|
+
def test_handles_nested_inside_regular_list_item
|
117
|
+
text = <<-md
|
118
|
+
- Item one
|
119
|
+
- [ ] subitem one
|
120
|
+
md
|
121
|
+
assert item = filter(text)[:output].css('ul:not(.task-list) li:not(.task-list-item) ul.task-list .task-list-item').pop
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_handles_nested_inside_multiple_regular_list_items
|
125
|
+
text = <<-md
|
126
|
+
- Item one
|
127
|
+
- [ ] subitem one
|
128
|
+
- Item two
|
129
|
+
- [ ] subitem two
|
130
|
+
md
|
131
|
+
assert_equal 2, filter(text)[:output].css('ul:not(.task-list) li:not(.task-list-item) ul.task-list .task-list-item').size
|
132
|
+
end
|
133
|
+
|
116
134
|
# NOTE: This is an edge case experienced regularly by users using a Swiss
|
117
135
|
# German keyboard.
|
118
136
|
# See: https://github.com/github/github/pull/18362
|
@@ -1,8 +1,8 @@
|
|
1
1
|
window.$ = window.jQuery = require('jquery')
|
2
|
-
window.TaskList = require('../../app/assets/javascripts/task_list')
|
2
|
+
window.TaskList = require('../../app/assets/javascripts/task_list.coffee')
|
3
3
|
|
4
|
-
|
5
|
-
beforeEach
|
4
|
+
describe "TaskList events", ->
|
5
|
+
beforeEach ->
|
6
6
|
@container = $ '<div>', class: 'js-task-list-container'
|
7
7
|
|
8
8
|
@list = $ '<ul>', class: 'task-list'
|
@@ -21,78 +21,56 @@ QUnit.module "TaskList events",
|
|
21
21
|
|
22
22
|
@container.append @field
|
23
23
|
|
24
|
-
$('
|
24
|
+
$('body').append @container
|
25
25
|
@container.taskList()
|
26
26
|
|
27
|
-
afterEach
|
27
|
+
afterEach ->
|
28
28
|
$(document).off 'tasklist:enabled'
|
29
29
|
$(document).off 'tasklist:disabled'
|
30
30
|
$(document).off 'tasklist:change'
|
31
31
|
$(document).off 'tasklist:changed'
|
32
|
+
@container.remove()
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
assert.expect 1
|
34
|
+
it "triggers a tasklist:change event before making task list item changes", (done) ->
|
35
|
+
@field.on 'tasklist:change', -> done()
|
36
36
|
|
37
|
-
|
38
|
-
assert.ok true
|
39
|
-
done()
|
37
|
+
@checkbox.click()
|
40
38
|
|
41
|
-
|
39
|
+
it "triggers a tasklist:changed event once a task list item changes", (done) ->
|
40
|
+
@field.on 'tasklist:changed', -> done()
|
42
41
|
|
43
|
-
|
44
|
-
done = assert.async()
|
45
|
-
assert.expect 1
|
42
|
+
@checkbox.click()
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
it "can cancel a tasklist:changed event", ->
|
45
|
+
event1 = new Promise (resolve) =>
|
46
|
+
@field.on 'tasklist:change', (event) ->
|
47
|
+
event.preventDefault()
|
48
|
+
resolve()
|
50
49
|
|
51
|
-
|
50
|
+
flush = null
|
51
|
+
event2 = new Promise (resolve, reject) =>
|
52
|
+
@field.on 'tasklist:changed', -> reject()
|
53
|
+
flush = resolve
|
52
54
|
|
53
|
-
|
54
|
-
done = assert.async()
|
55
|
-
done2 = assert.async()
|
56
|
-
assert.expect 2
|
55
|
+
@checkbox.click()
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
done2()
|
57
|
+
await event1
|
58
|
+
flush()
|
59
|
+
await event2
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
setTimeout =>
|
68
|
-
assert.ok true
|
69
|
-
done()
|
70
|
-
, 20
|
71
|
-
|
72
|
-
@checkbox.click()
|
73
|
-
|
74
|
-
QUnit.test "enables task list items when a .js-task-list-field is present", (assert) ->
|
75
|
-
done = assert.async()
|
76
|
-
assert.expect 1
|
77
|
-
|
78
|
-
$(document).on 'tasklist:enabled', (event) ->
|
79
|
-
assert.ok true
|
80
|
-
done()
|
81
|
-
|
82
|
-
@container.taskList()
|
83
|
-
|
84
|
-
QUnit.test "doesn't enable task list items when a .js-task-list-field is absent", (assert) ->
|
85
|
-
done = assert.async()
|
86
|
-
assert.expect 1
|
87
|
-
|
88
|
-
$(document).on 'tasklist:enabled', (event) ->
|
89
|
-
assert.ok false
|
61
|
+
it "enables task list items when a .js-task-list-field is present", (done) ->
|
62
|
+
$(document).on 'tasklist:enabled', -> done()
|
63
|
+
|
64
|
+
@container.taskList()
|
90
65
|
|
91
|
-
|
66
|
+
it "doesn't enable task list items when a .js-task-list-field is absent", ->
|
67
|
+
flush = null
|
68
|
+
event = new Promise (resolve, reject) ->
|
69
|
+
$(document).on 'tasklist:enabled', -> reject()
|
70
|
+
flush = resolve
|
92
71
|
|
93
|
-
|
72
|
+
@field.remove()
|
73
|
+
@container.taskList()
|
94
74
|
|
95
|
-
|
96
|
-
|
97
|
-
done()
|
98
|
-
, 20
|
75
|
+
flush()
|
76
|
+
await event
|