deckar01-task_list 2.3.2 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deckar01-task_list",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
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
- "qunit": "karma start test/unit/config.js",
14
+ "unit": "web-test-runner bin/test/unit/*.js",
15
15
  "lint": "coffeelint app/assets/javascripts/task_list.coffee",
16
- "build:css": "node-sass -o dist/ app/assets/stylesheets/task_list.scss",
17
- "build:js": "webpack",
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
- "prepublish": "npm run build"
19
+ "prepare": "npm run build"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "git+https://github.com/deckar01/task_list.git"
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://github.com/deckar01/task_list/issues"
35
+ "url": "https://gitlab.com/deckar01/task_list/issues"
36
36
  },
37
- "homepage": "https://github.com/deckar01/task_list#readme",
37
+ "homepage": "https://gitlab.com/deckar01/task_list#task-lists",
38
38
  "devDependencies": {
39
- "bower": "^1.8.0",
40
- "coffee-loader": "^0.9.0",
41
- "coffeelint": "^1.16.0",
42
- "coffeescript": "^2.4.1",
43
- "jquery": "^2.2.4",
44
- "karma": "^4.4.1",
45
- "karma-chrome-launcher": "^3.1.0",
46
- "karma-qunit": "^4.0.0",
47
- "karma-webpack": "^4.0.2",
48
- "node-sass": "^4.5.2",
49
- "phantomjs": "^1.9.19",
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
- ./node_modules/bower/bin/bower install --no-color
16
+ npm exec -- bower install --no-color
data/script/cibuild CHANGED
@@ -3,5 +3,5 @@
3
3
  # CI build script.
4
4
 
5
5
  npm run lint
6
- npm run qunit
6
+ npm run unit
7
7
  bundle exec rake test
data/task_list.gemspec CHANGED
@@ -15,14 +15,21 @@ 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
 
21
28
  gem.add_dependency "activesupport", "~> 4.0" if RUBY_VERSION < '2.2.2'
22
29
  gem.add_dependency "nokogiri", "~> 1.6.0" if RUBY_VERSION < '2.1.0'
23
- gem.add_dependency "html-pipeline"
30
+ gem.add_dependency "html-pipeline", "~> 2.0"
24
31
 
25
- gem.add_development_dependency "commonmarker"
32
+ gem.add_development_dependency "commonmarker", "~> 0.23"
26
33
  gem.add_development_dependency "rake"
27
34
  gem.add_development_dependency "coffee-script"
28
35
  gem.add_development_dependency "json"
@@ -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
@@ -141,6 +159,15 @@ class TaskList::FilterTest < Minitest::Test
141
159
  assert_equal 2, filter(text)[:output].css("[checked]").size
142
160
  end
143
161
 
162
+ def test_dangling_checkbox
163
+ text = <<-md
164
+ - one
165
+ - foo
166
+ [ ] bar
167
+ md
168
+ assert_equal 0, filter(text)[:output].css(@item_selector).size
169
+ end
170
+
144
171
  protected
145
172
 
146
173
  def filter(input, context = @context, result = nil)
@@ -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
- QUnit.module "TaskList events",
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
- $('#qunit-fixture').append(@container)
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
- QUnit.test "triggers a tasklist:change event before making task list item changes", (assert) ->
34
- done = assert.async()
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
- @field.on 'tasklist:change', (event, index, checked) ->
38
- assert.ok true
39
- done()
37
+ @checkbox.click()
40
38
 
41
- @checkbox.click()
39
+ it "triggers a tasklist:changed event once a task list item changes", (done) ->
40
+ @field.on 'tasklist:changed', -> done()
42
41
 
43
- QUnit.test "triggers a tasklist:changed event once a task list item changes", (assert) ->
44
- done = assert.async()
45
- assert.expect 1
42
+ @checkbox.click()
46
43
 
47
- @field.on 'tasklist:changed', (event, index, checked) ->
48
- assert.ok true
49
- done()
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
- @checkbox.click()
50
+ flush = null
51
+ event2 = new Promise (resolve, reject) =>
52
+ @field.on 'tasklist:changed', -> reject()
53
+ flush = resolve
52
54
 
53
- QUnit.test "can cancel a tasklist:changed event", (assert) ->
54
- done = assert.async()
55
- done2 = assert.async()
56
- assert.expect 2
55
+ @checkbox.click()
57
56
 
58
- @field.on 'tasklist:change', (event, index, checked) ->
59
- assert.ok true
60
- event.preventDefault()
61
- done2()
57
+ await event1
58
+ flush()
59
+ await event2
62
60
 
63
- @field.on 'tasklist:changed', (event, index, checked) ->
64
- assert.ok false
65
-
66
- before = @checkbox.val()
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
- @field.remove()
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
- @container.taskList()
72
+ @field.remove()
73
+ @container.taskList()
94
74
 
95
- setTimeout =>
96
- assert.ok true
97
- done()
98
- , 20
75
+ flush()
76
+ await event